1

I have a html file with this in it:

<div id="date">Saturday 04.08.18<br><div id="time">23<img src="media/images/sec.gif">59</div></div>

and i want to delete this complete element out of the html file but the values are changing each minute (because it is the time)

i had tried this command edited from another guy here but it is not working.

sed -z -r -i 's#<div id="date">[^<]*</div></div>\n?##g' 1.htm

i think this may not work because there starts another html element in the element?

jww
  • 97,681
  • 90
  • 411
  • 885
Jan2220
  • 11
  • 1

1 Answers1

1

One possible solution will be the following:

sed -r -e 's#<div id="date">.*</div></div>\n?##g' 1.htm

what it does is basically substitute with empty string the lines containing div tag with date id, followed by, greater than zero (or equal to) characters, ending with two closing div tags, plus a new line char

Lino
  • 5,084
  • 3
  • 21
  • 39