Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

How can I remove everything between two lines in a file?

by Anonymous Monk
on Dec 28, 2000 at 20:31 UTC ( #48631=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: (files)

I have two lines, lets say "-line1-" and "-line2-" and between these lines I have some lines. The amount and the content of these lines are unknown. Like this:
some lines -line1- lineA: xxx lineB: y lineC: zz -line2- more lines
So, I want to remove everything between "-line1-" and "-line2-", in this case lines A, B and C. How can I do this?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Removing everything between two lines
by merlyn (Sage) on Dec 28, 2000 at 20:34 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://48631]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2021-04-21 04:36 GMT
Find Nodes?
    Voting Booth?

    No recent polls found