[wplug] replacing text within full website
Joe
joe at terrarum.net
Tue Jan 6 02:56:21 EST 2004
I'm sure the perl guru's on the list will have me lynched for this..
but hey I'm tired..
Try..
#!/usr/bin/perl
open (FILE, "$ARGV[0]");
open (FILE2, ">$ARGV[0].tmp");
while (<FILE>) {
$_ =~ s/kingpin/www.foo.bar/g;
print FILE2 $_;
}
close(FILE);
close(FILE2);
rename("$ARGV[0].tmp", "$ARGV[0]");
That should do it..
then from the command line just run
$ ./whateveryoucallit.pl file.txt
And I'm sure there are more elegant perl-y ways (or even a command-line
sed way) to write it.. but like I said.. I'm tired :)
---
Joe Topjian
email: joe at terrarum.net
web: http://zaven.us
More information about the wplug
mailing list