I'd like to remove a series of elements like:

div-id="st-head" class="noprint"

from a html file.

  • 1
    Show example input with corresponding output please – Scony Mar 16 '14 at 2:02
  • Yes please cite a couple of the situations where this code is contained in these files. Otherwise this isn't much to go on. – slm Mar 16 '14 at 2:03

If all you want is to delete that exact string and don't care where it's found or anything about context at all, just do this:

sed -i.bak 's/div-id="st-head" class="noprint"//g' a.html b.html c.html

That will remove every occurrence of that string from each html file listed and a copy of the original called [filename.html].bak.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.