Help for this page

Select Code to Download


  1. 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
    
  2. or download this
    perl -e 'BEGIN {$col=1}' -lane '$sum += $F[$col]; 
              END {print "Sum of column $col for $. line: $sum"}' file.tab
    
  3. or download this
    perl -lane '$sum += $F[1]; END {print $sum}' file.tab