Oneliner-question
Posted
by sid_com
on Stack Overflow
See other posts from Stack Overflow
or by sid_com
Published on 2010-04-28T07:51:26Z
Indexed on
2010/04/28
7:53 UTC
Read the original article
Hit count: 338
I proudly present a solution to the problem:
perl -00 -F"\n" -anE '$_ = ( split / /, $F[1] )[0]; if ( !/error/ ) { $sum += $_; $c++ } } { say $sum / $c' file
The problem: the first field of the second line of each paragraph if it is not error.
How could I do this without the paragraph-mode?
perl -anE 'say $F[0] if not /error/ and the second /\S+/ after /^$/' file
© Stack Overflow or respective owner