Issue
I have an HTML file with local paths to images like so - /image1.jpg or /image2.png
I want to use SED to prefix a desired url to that like so - rel="nofollow noreferrer">https://example.com.
Desired result is https://example.com/image1.jpg
I tried this -
sed "s#.*.jpg#https://example.com/*.jpg#g" index.html > index2.html
The result is index2.html which finds the image names but my replacement does not use those names. How to keep that match name?
Any suggestions?
Sample Input -
<img src="Image1.jpg" alt="boat" /><figcaption>boat</figcaption>
Sample Output -
<img src="https://example.com/image1.jpg" alt="boat" /><figcaption>boat</figcaption>
Solution
Using sed
$ sed 's#="#&https://example.com#' input_file
<p><img src="https://example.com/image1.jpg" /></p>
Answered By - HatLess Answer Checked By - Candace Johnson (WPSolving Volunteer)