in reply to Re^2: How to print 5 lines below after a regex match
in thread How to print 5 lines below after a regex match
Set the flag first then print
pojuse strict; my $flag = 0; my $few = shift || 3; while (<DATA>) { $flag = $few if (/Update certificate/); print $_ if ($flag-- > 0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to print 5 lines below after a regex match
by Laurent_R (Canon) on Feb 24, 2016 at 21:30 UTC |