Re: Remove text between two 'tags'



Chris F.A. Johnson wrote:

To remove all instances:

sed '/<div class="handheld">/,/<\/div>/d'



And, if there are nested <div> tags:

which there are, although I could possibly change that.

awk '/<div class="handheld">/ { x = 1; next }
/<div / && x > 0 { ++x }
/<\/div>/ && x > 0 { --x; next }
x == 0 { print }'


cheers.


If you are willing to change them by hand, why not get rid of them
at the same time?

Since I will make changes to the files.

I don't mind hacking it once to make it easier to edit automatically, but I don't want to make changes that will require me to edit it manually if I change the content - if that makes any sence!!

--
Dave K MCSE.

MCSE = Minefield Consultant and Solitaire Expert.

Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@domain. Hitting reply will work
for a couple of months only. Later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)
.



Relevant Pages