Convert HTML document to use relative links ?

Is there is program to make all links relative in HTML documents
saved in wget -x fashion ? ( saved as

For example,

- if ./ contains <img src="/images/d.jpg">
and ./
exists, replace that tag <img src="../images/d.jpg">

- if ./ contains <a href="";>
and ./
exists, replace that tag by <a href="../../">

I know about wget -k and it doesn't do what I need. My goal is 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 <>, a spammer's favourite.

To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx