Convert specific word to HTML hyperlink using sed command
Hello,
I need to convert a word to HTML hyper text link . Each occurrence of the word Quote:
Code:
<a href="#pNNN"> So: Quote:
Code:
See <a href="#p107">page 107</a> |
Ok. What have you tried, based on your other earlier question? One tip is that the separator for sed does not have to be a slash / and it can be anything else instead:
Code:
sed -e 's|old|new|' |
Code:
sed -r '/page/s,page ([[:digit:]]+),<a href="#p\1">&</a>,' |
I see potential corner cases all over the place - like whitespace count f'instance ...
We all know it can work, but any regex has to be absolutely specific - and that means the OP has to know the data precisely. And be able to enunciate it. Precisely. |
One more time, an XML editing utility might be more appropriate.
I have a little experience with xmllint, which I think is too limited for this task, and less experience with xmlstarlet, which I think might be appropriate here. |
All times are GMT -5. The time now is 09:33 PM. |