- or download this
# First we make to test files
% perl -le 'print join(",", map int(rand(1000)), 1..10) for 1..50' > i
+n1.csv
...
# V
perl -lanF, -e '$sum += $F[6]; print "Sum is $sum" if eof()' in1.csv i
+n2.csv
Sum is 48874
- or download this
perl -lanF, -e '$total += $F[6]; $sub += $F[6]; print "Subtotal: $sub"
+ and $sub = 0 if eof; print "Total: $total" if eof()' in1.csv in2.csv
Subtotal: 23789
Subtotal: 25085
Total: 48874
- or download this
perl -lanF, -e '$sum += $F[6]; END{ print "Sum is $sum" }' in1.csv in2
+.csv