As a one-liner
Substitute your match criteria for /line 05/, the number after for the constant 4 and the name of your file at the end.perl -ne "$n = $.if /line 05/; print if $n and $. == ( $n + 4 )" numbe +red.dat
As a program
#! perl -sw use strict; my $p; while (<DATA>) { $p = $. if /$ARGV[0]/; print if $p and $. == ( $p + $ARGV[1] ); } =pod output (comment only) c:\test>210984 "line 05" 4 line 09 c:\test> =cut __DATA__ line 01 line 02 line 03 line 04 line 05 line 06 line 07 line 08 line 09 line 10 line 11 line 12 line 13 line 14 line 15 line 16 line 17 line 18 line 19 line 20
In reply to Re: Search String - next line
by BrowserUk
in thread Search String - next line
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |