bash - checking that the rows in a file have the same number of columns -


i have number of tsv files, , want check each file correctly formatted. primarily, want check each row has right number of columns. there way this? i'd love command line solution if there one.

awk '{print nf}' test | sort -nu | head -n 1 

this gives lowest number of columns in file on given row.

awk '{print nf}' test | sort -nu | tail -n 1 

this gives highest number of columns in file on given row. result should same, if columns present.

note: gives me error on os x, not on debian... maybe use gawk.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -