Connecting Tech Pros Worldwide Help | Site Map

Converting links in HTML documents to relative URL ?

  #1  
Old September 4th, 2008, 10:35 AM
Andre Majorel
Guest
 
Posts: n/a
Is there some command-line program for Unix to make all links
relative in HTML documents saved in wget -x fashion ?
(http://foo.com/a/b.html saved as ./foo.com/a/b.html.)

For example,

- if ./foo.com/a/b.html contains <img src="/images/d.jpg">
and ./foo.com/images/d.jpg
exists, replace that tag by <img src="../images/d.jpg">

- if ./foo.com/a/b.html contains <a href="http://bar.org/c.html">
and ./bar.org/c.html
exists, replace that tag by <a href="../../bar.org/c.html">

I know about wget -k and it doesn't do what I need. My goal is
to use wget or some such to have an exact mirror of the web site
and then make a _copy_ of the mirror that can be navigated
off-line.

Thanks in advance.

--
André Majorel <URL:http://www.teaser.fr/~amajorel/>
"Je regrette le Concorde. Au moins il vous amenait directement à
l'hôtel." -- Cyrano
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 08:57 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 07:46 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 03:55 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 5 November 14th, 2005 12:36 PM