Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 scrutinizing the Monastery: (4)
As of 2020-02-24 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (104 votes). Check out past polls.

    Notices?