I want to replace multiple lines starting from the next line of the occurrence by one line.
For example, I have the following section of an html file:
...
<div class="myclass">
<p textselect="true">
one
two
three
</p>
</div>
...
I want to end up with
...
<div class="myclass">
<p textselect="true">
hello
</p>
</div>
...
...but I need to be able to match the string with <p textselect="true">, rather then with one, as I don't know what that string (one) is going to be.
Right now my solution is pretty nasty. I am appending a placeholder after <div class="myclass">, I delete the placeholder and the next 3 lines, then I append again the string I want. All with sed. I need it to be either with sed or awk.