I too have something similar requirement as specified in this thread but the number of columns in my case can be very high, so I am getting following error.
user1 [/aaaa/bbb] $ --> awk -F'|' '{print NF}' myfile.txt
awk: record `AAAAAAAAA|B|CCCCCC|DDDDDDDD...' has too many fields
Any other way to achieve or it is a limitation for awk command.
Documentation says 99 is the max value for NF:
HPUX 11.0 awk supports 199. gawk on our old RH box is 255.
As you may guess, there are several versions of awk.
You can use, cut instead of awk.(Few limitations here however).