Oneliner-question
- by sid_com
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