in reply to How do I remove lines from a file...

while( <> ) { do { print; last } if /^MYTAG2/; } print while <>;

Replies are listed 'Best First'.
Re: Fish
by CukiMnstr (Deacon) on Apr 09, 2002 at 21:53 UTC
    hm. you have to consider that with your code every line from the beginning of the file until /^MYTAG2/ will be skipped, instead of the text between /^MYTAG1/ and /^MYTAG2/

      Correct, but given the example data file it works. :)

      If the file doesn't start with MYTAG1, then you'd of course need to prefix with

      while( <> ) { last if /^MYTAG1/; print }

      Or use something like Re: How do I remove lines from a file....