Sum of 286th column using awk in a file

Hi,

I am using the following code to find the sum of the values of column 286 in a file. It will have the Decimal values with the scale of 2. Delimiter is '|^'

cut -d'|^' -f286 filename|cut -c3-| awk '{ x += $1 } END { printf("%.2f\n", x) }'

There are around 50k records in this file and for few files this code is running fine but for some files the Sum value is not correct. This is verified by the summing the data loaded in the table from the file.

Let me know if any changes are to be made to the above code.

Thanks,
Jram.

awk F"|^" '{ x += $256 } END { printf("%.2f\n", x) }' filename

Do you have example of your file

Are you sure about the field delimiter? When using your above code, GNU cut tells me cut: the delimiter must be a single character

The other cut which I have here says: cut: bad delimiter