unix - count of columns in file
awk -F'|' '{print NF; exit}' stores.dat
Just quit right after the first line.
Unless you're using spaces in there, you should be able to use | wc -w
on the first line.
wc
is "Word Count", which simply counts the words in the input file. If you send only one line, it'll tell you the amount of columns.
This is a workaround (for me: I don't use awk very often):
Display the first row of the file containing the data, replace all pipes with newlines and then count the lines:
$ head -1 stores.dat | tr '|' '\n' | wc -l