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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using sed for finding & removing a multiline pattern

Status
Not open for further replies.

esterud

Technical User
Jan 30, 2003
7
US
I am writing a big script and in part of it I need to remove 7 specific lines from a file, and I need to do this making sure that it will only delete these lines if all the lines exist in sequence. Here are the lines:

#
# NetBackup services
#
bprd blah blah
bpjava_msvc blah blah
bpcd blah blah
vopied blah blah

I want to do this using sed, and I am fairly sure it is possible but cannot figure out how to do it.
 
Yes this will give me the end result I want, but it is still not pattern-matching the way I want.

In the sed command I need to reference and pattern-check for every individual line from beginning to end, (carriage returns and all)-- not just saying everything between the 1st "#" line and the last "vopied..." line. I need to do this because I need to be absolutely sure that I only delete the lines if the lines are exactly what I am pattern-matching for and that they are and in the exact sequence I am pattern-matching for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top