Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: cut vs split (suggestions)

by Mabooka-Mabooka (Sexton)
on Apr 17, 2005 at 19:53 UTC ( #448680=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Mabooka % head -1 numbers.csv
    462,393,252,996,663,603,344,439,139,259,879,766,545,192,477,986,317,77
    +,611,303,79,742,190,556,538
    ...
    Mabooka % diff f1 f2
    Mabooka % 
    
  2. or download this
    Mabooka % time perl -nle'my($a,$b,$c,$d,$e)=split /,/;$ta+=$a, $tb+=$b
    +, $tc+=$c, $td+=$d, $te+=$e;END{print join " ", $ta,$tb,$tc,$td,$te}'
    + numbers.csv
    2499084140 2499188390 2500073650 2497725180 2495867770
    ...
    2499084140 2499188390 2500073650 2497725180 2495867770
    18.520u 0.490s 0:12.52 151.8%   0+0k 0+0io 575pf+0w
    Mabooka % 
    
  3. or download this
    Mabooka % cat sum5.cut_n_awk
    #
    cat numbers.csv | cut -f1,2,3,4,5 -d, |awk -F, '{s1 += $1; s2 += $2; s
    +3+= $3; s4+=$4; s5+=$5} END {printf  ("%.0f %.0f %.0f %.0f %.0f\n", s
    +1, s2,s3,s4,s5)}'
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2015-07-29 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls