View previous topic :: View next topic |
Author |
Message |
jasn Guru
Joined: 05 May 2005 Posts: 439 Location: Maryland, US
|
Posted: Fri Jun 28, 2013 5:08 pm Post subject: [Solved] sed help - converting html links |
|
|
wget didn't seem to localize all the links in the html files, after downloading a website for me. So I have some html files in where I'd like to redirect the links to point to local versions of the files. So where there is the line;
Code: | href="http://www.yoyodyne.haha/index.html" |
I would like to change it to;
and where there is the following line;
Code: | src="http://www.yoyodyne.haha/Picture1.jpg" |
I would like to change that to;
Code: | src="images/Picture1.jpg" |
I bascially don't how to handle single quotation marks, equals signs, and periods, in the sed command, because I need to differentiate the;
lines, from the
lines. I tried different sed expressions and couldn't come up with anything that worked.
Any help would be appreciated.
Thanks..
Last edited by jasn on Fri Jun 28, 2013 7:29 pm; edited 1 time in total |
|
Back to top |
|
|
666threesixes666 Veteran
Joined: 31 May 2011 Posts: 1248 Location: 42.68n 85.41w
|
|
Back to top |
|
|
jasn Guru
Joined: 05 May 2005 Posts: 439 Location: Maryland, US
|
Posted: Fri Jun 28, 2013 7:26 pm Post subject: |
|
|
Thanks for the tips and links, but that's similar information to what I was reading earlier, and it didn't help me sort out how to handle the non-alpha characters in the sed command line. However, your response did prompt me to do some more online searches for sed examples, like this one, and give it another try. I think I have a working sed command now;
For the href links;
Code: | sed -i s,href=\"http:\/\/www.yoyodyne.haha/\,href=\", *.html |
and for the image src links;
Code: | sed -i s,src=\"http:\/\/www.yoyodyne.haha,src=\"images, *.html |
Anyone, please feel free to comment further, but I'll mark this solved.
Thanks again.. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|