출처: https://stackoverflow.com/questions/8629330/unix-count-of-columns-in-file

 

unix - count of columns in file

Given a file with data like this (i.e. stores.dat file) sid|storeNo|latitude|longitude 2|1|-28.03720000|153.42921670 9|2|-33.85090000|151.03274200 What would be a command to output the number of ...

stackoverflow.com

column 사이즈 상관없이 파일 내의 column 갯수를 알고자 할 때,

 

$ head -1 [파일명] | tr '[구분자]' '\n' | wc -l

Posted by halloRa
,