Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting with SED

Status
Not open for further replies.

Fozzeebear

Technical User
Oct 20, 2003
6
0
0
GB
I need to delete particular blocks of text from a file using Sed.

Using '/AAA/,/BBB/d' I can delete from string AAA up to and including BBB. However, what do I need to use to delete from AAA up to and including the next line after BBB?

Is there an alternative for Sed that can be used to do this?
 
I'd use awk:
Code:
/AAA/{f=1}
/BBB/{f=2;next}
f==0{print}
f==2{f=0}

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top