Say I have a large file with many rows and many columns. I\'d like to find out how many rows and columns I have using bash.
Columns: awk '{print NF}' file | sort -nu | tail -n 1
awk '{print NF}' file | sort -nu | tail -n 1
Use head -n 1 for lowest column count, tail -n 1 for highest column count.
head -n 1
tail -n 1
Rows: cat file | wc -l or wc -l < file for the UUOC crowd.
cat file | wc -l
wc -l < file