These simple combination of commands are quite powerful. I am listing the commands that I used on some of the projects for later reference.
- Find the number of columns and how many rows are there for those columns
awk -F, '{a[NF]++} END {for (e in a) {print e ":" a[e]}}'
file.csv
output3:13730
4:5
5:1
7:1
8:1 - Find the line with a given number of columns in a csv file. Update NF to the number of columns
awk -F, 'NF==4 {print NR, $0}' file.csv