in reply to A new question from the front line
Your second solution could have been written as follows: perl -ne 'print ++$i . <> if /energy/' filenameperl -ne 'print if $prev; $prev = /energy/' file # Or with a counter perl -ne 'print ++$i, $_ if $prev; $prev = /energy/' file
--
John.
|
|---|