[TAG] Fixing absolute links in a mirror
Ben Okopnik
ben at callahans.org
Sun Jul 18 07:47:40 MSD 2004
On Sun, Jul 18, 2004 at 02:21:16AM +0100, Thomas Adam wrote:
> On Sun, 18 Jul 2004 02:19:37 +0100
> Paul Nolan <onewingedangel at uklinux.net> wrote:
>
> > Hi,
> > I recently downloaded a BIG website using wget, but I (stupidly)
> > forgot to make the links relative. Now none of the images or links
> > work on the website. Is there a way to fix this without downloading it
> > again (I've heard Perl can do this, but it scares me half to death
> > even looking at Perl source).
> >
> > Please, please, please help!
>
> Can you send us an example of what it currently looks like, and what you
> want it changed to?
Presumably, it'll take something like
# Scary Perl solution
perl -i -wlpe's#(href\s*=\s*["\047])(?:http//)?www\.server\.com/([^>]#$1$2#gi' *html
or it could be as simple as
# Nice and easy - with an odd lot of assumptions
perl -i -wlpe"s'www.server.com/''g" *html
Until you define the exact situation, it could be either of those,
something in between, or something totally different. Thomas has it
right: more info, please!
* Ben Okopnik * okopnik.freeshell.org * Editor-in-Chief, Linux Gazette *
-*- See the Linux Gazette in its new home: <http://linuxgazette.net> -*-
More information about the TAG
mailing list