Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Scriptome and Perl One-Liners

by rnahi (Curate)
on Oct 23, 2005 at 15:01 UTC ( #502312=note: print w/replies, xml ) Need Help??

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
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://502312]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2020-10-20 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?