Challenge: add up the values in column 6 of a spreadsheet starting at row 3 and going to row X (X because the number of rows in each file are variable).
I have ~1000 files in a directory that I would like to do this for. I managed to come up with the following:
awk 'BEGIN {FS = ","} FNR>2 {sum+=$6} END {print sum}' SR* >output.txt
This works, but I want the sum to be printed for each input file separately, all into one output file. What do I need to change in my script to accomplish that?
Any help would be greatly appreciated - and please keep in mind I really don't have a firm understanding for using the command line.