in reply to Re^3: need to extract top and bottom lines...in thread need to extract top and bottom lines...
perl -ne 'sub BEGIN {$l="";}$l=$_, next unless /ERROR/;print /^[^12]/ +? "$l$_" : $_;$l=$_;' some.log [download]
Johngg