in reply to How to print 5 lines below after a regex match
As we do not have a terminator string, I used undef.
$M=1 when the match is found,
$M=2 on the first line after the match.
perl -ne 'if($M=/Update certificate/..undef){print if($M>1 && $M<=6)}'
to also print the matched line as well (header):
perl -ne 'if($M=/Update certificate/..undef){print if $M<=6}'
IMPORTANT: due to having no terminator string, it will only match once in a given file.
|
|---|