It might look something like this:
while ($url_stack is not empty) { $url = pop $url_stack; open URL $url; while (<URL>) { my @words split / /, $_ # split a line into words # For each word in the line, see if it's a URL. Push # it to the stack and substitute the local path if it # is foreach my $word @words { if $word =~ m/^http:\/\//; push $word $url_stack; $word =~ s/'remote_path'/'local_path'/; } # join all the words together into a new line join @words my $output_line; # write that line into the local version of the file. print <LOCAL_VERSION> $output_line; } }
As this is intended to be a psuedo-code snippet, I'm obviously leaving a lot out, like opening the output file, &c, but I think the basic premise is sound.
That said, I'm sure there is an easier way to do it. w3mir, for example. You also might look into wget options to make sure you're not missing something in there. Good luck!
In reply to Re: Need direction on mass find/replacement in HTML files.
by starX
in thread Need direction on mass find/replacement in HTML files.
by kevin4truth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |