In a file containing tags like these:
<div class="myclass">
Something irrelevant.
</div>
<div class="myclass">
MATCH ME
</div>
I would like to delete all tags not containing a specific pattern, here "MATCH ME" as an example. I can search for the opening of the tag, then do vat
, inspect the selection, if it doesn't contain my pattern I hit d
to delete it and move on to the next candidate with n
, else I will hit n
straight, continuing to the end of the file. Now I'd like to automate that, as I have a few files like that. How?