how to change the content of lines in an html file using regex/grep
by toothwright from LinuxQuestions.org on (#4SR12)
I am running Linux Mint 19.2.
I have an html file containing 1400 lines of this sort:-
<li>Some Name <a href="http://www.anything.co.uk/name.htm">REF NUMBER</a></li>
The line between <a href=" and .htm"> is of variable length.
I want to change the lines to read:
<li><a href="local directory/X.pdf">Some Name REF NUMBER</a></li>
I will replace X in the line manually (as it varies).
The object is to remove the online requirement for the list.
I know it must be possible with regex or grep and I have spent time looking at tutorials but without real comprehension.
I should be grateful if a member would be kind enough to provide me with help/clues....


I have an html file containing 1400 lines of this sort:-
<li>Some Name <a href="http://www.anything.co.uk/name.htm">REF NUMBER</a></li>
The line between <a href=" and .htm"> is of variable length.
I want to change the lines to read:
<li><a href="local directory/X.pdf">Some Name REF NUMBER</a></li>
I will replace X in the line manually (as it varies).
The object is to remove the online requirement for the list.
I know it must be possible with regex or grep and I have spent time looking at tutorials but without real comprehension.
I should be grateful if a member would be kind enough to provide me with help/clues....