perl -ne 'sub BEGIN {$l="";}$l=$_, next unless /ERROR/;print /^[^12]/ +? "$l$_" : $_;$l=$_;' some.log
Not Y3K compliant.
JohnGG
Note: something is eating the square brackets around the character class ^12 for some reason. Code tags don't help.
In reply to Re^3: need to extract top and bottom lines...
by johngg
in thread need to extract top and bottom lines...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |