i am stuck with this awk command. i need to calculate the sum of a column of values on a flatfile and i am using the following command :
awk -F"|" '{x += $10} END {print "Sum: "x}' standard_csv_file1.out
that flatfile contains 180 fields and i am getting the following error.
awk: record `"D"||||||2449|||203|...' has too many fields
record number 1
i tried the same command when i had few fields (may be 30 or so) it worked fine. but in order to standardise the flatfile, i have to add too many null value fields and now the total number of fields is 180 and the command doesn't work saying too many fields. any way around please.
thanks for the responses guys. the cut command doesn't work as well unfortunately. i am working on solaris. it seems gawk doesn't work on it but nawk works on it. could you please tell me the equivalant nawk command for my command. i am a novice with poor unix skills. please don't mind.