- or download this
perl -ne 'BEGIN {$col=1}' -e 's/\r?\n//; @F=split /\t/, $_; $sum += $F
+[$col];
END {warn "Sum of column $col for $. lines\n"; print "$sum\n"}' file.t
+ab
- or download this
perl -e 'BEGIN {$col=1}' -lane '$sum += $F[$col];
END {print "Sum of column $col for $. line: $sum"}' file.tab
- or download this
perl -lane '$sum += $F[1]; END {print $sum}' file.tab