in reply to Replacing all but one duplicate lines
Your code suggests that you want to make the changes "in-place". You could do it all in a one-liner as follows: perl -i.bak -ne 'print unless /pattern/ and $i++' file Enjoy your vacation. :-)my $i = 0; while (<FILE>) { $temp .= $_ unless /$heading_to_print/ and $i++; }
--
John.
|
|---|