count columns separated by space
awk '{ print NF }' <<< 'a bc d ef'
count columns separated by comma
awk -F, '{ print NF }' <<< 'a,b,c'
count columns separated by tab
echo -e 'a\tb\tc' | awk -F'\t' '{ print NF }'
get number of columns from a file
awk '{ print NF }' file
get sum of columns from a file
awk '{ print NF }' file | sort | uniq -c
print only lines that have 3 columns
echo -e 'a b c\nx y' | awk 'NF == 3'
print only lines that have 7 columns from a file
awk 'NF == 7' file