[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SED problem



Michael D Schleif wrote:

Michael D Schleif <mds@helices.org> [2003:10:04:16:32:37-0500] scribed:
Dave selby <debian@pusspaws.net> [2003:10:04:19:25:32+0100] scribed:
I have multiple html files. I need to remove the same chunk of code from all of them. I have made a bash loop to feed the files to sed, but am struggling with the sed code.

I need to delete all the code between

<!-- lockon:a:1
-->

and

<!-- lockoff
-->

Including the above comments.
Do you want to specify a range like this:

  sed '/<!-- lockon:a:1/,/<!-- lockoff/d' /tmp/tmp.txt

Oops!  I forgot about the closing the lockoff comment:

# sed -f /tmp/tmp.sed /tmp/tmp.txt

# cat /tmp/tmp.sed /<!-- lockon:a:1/,/<!-- lockoff/{
       N
       /-->/d
       D
}

Many thanks, it works great ... just playing with it to get how it works !

Dave





Reply to: