my @line_nums = (44, 87, 345); my $line_num = shift(@line_nums); my $more = 2; while (<>) { next if $. != $line_num; print; if ($more) { --$more; ++$line_num; shift(@line_nums) if @line_nums && $line_nums[0] == $line_num; next; } last unless @line_nums; $line_num = shift(@line_nums); $more = 2; }
Tested:
Features:
Limitations:
To do:
In reply to Re: Printing specific line numbers
by ikegami
in thread Printing specific line numbers
by tsk1979
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |