I've html file (e.g. curl -o page.html http://example.com/
) where I would like to remove inner html block for given html tag.
I've the following code which works:
$ ex -V1 page.html <<-EOF
/<h1>
norm nvitd " Jump to next match and remove the inner tag block.
wq
EOF
However I'd like to make the condition to execute norm nvitd
only when the pattern <h1>
is found. For example when testing with <h2>
then the next line is executed generating the warnings, despite the pattern is not found.
How to make such condition? It's possible to make it in one line (like a ternary operator)?