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

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -