$ cat sd.pl my $counter = -1; # (so it's never zero until decrement does it) while (<IN>) { if /SCHEDULE/ { # (use right regex here) $counter = 2; } else if ($counter-- == 0) { // third line } } $ perl -cw sd.pl syntax error at sd.pl line 3, near "if /SCHEDULE/" syntax error at sd.pl line 6, near "else" sd.pl had compilation errors. $
In reply to Re^2: Print n lines after a matched line
by hippo
in thread Print n lines after a matched line
by sreek3502
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |