in reply to perl onliner on multiple files
This (untested) may do what you want:
perl -nE"/: / and $c+= (split/: /)[0]; if( eof(ARGV) ){ say qq[SUM.$AR +V =$c]; $c=0 }" tmp_*
- -n:
provides the while(<>){} loop.
- the if( eof(ARGV) )
checks for the end of each individual file, prints the results and resets $c to 0.
- $ARGV:
gives you the names of the individual files in the output.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: perl onliner on multiple files
by abhay180 (Sexton) on Feb 08, 2013 at 21:16 UTC | |
by BrowserUk (Patriarch) on Feb 08, 2013 at 22:35 UTC | |
by 7stud (Deacon) on Feb 08, 2013 at 23:54 UTC | |
by abhay180 (Sexton) on Feb 09, 2013 at 10:05 UTC | |
by Anonymous Monk on Feb 09, 2013 at 09:24 UTC |
In Section
Seekers of Perl Wisdom