I have a site that need to made some mass edit, I used sed to perform most of the task but add the heading tag(<h1>, <h2>) is so tricky that I can’t think up of a way to due with:
The pattern that I could guarantee is as follow:
<td class="content_subhd">Heading Name</td>
I want to change it to:
<td class="content_subhd"><h2>Heading Name</h2></td>
Where Heading Name is not static, it is different on each page and this is why I can use substitute to due with it.
Any suggestion?
2 tricks needed:
Use pattern grouping
\( ... \)and reinsertion\1Use a colon as pattern seperator instead of
/to avoid excessive quotingResult: