Simple sum¶
Consider this .csv file:
sample.csv
ID,AMOUNT
1,3.33
2,8.66We can then use this Awk program to sum the amount column:
$ awk -F ',' '{ sum+=$2; } END { print sum; }'And then feeding the file to the program:
$ awk -F ',' '{ sum+=$2; } END { print sum; }' ./sample.csv
11.99