in reply to Massive File Editing
use File::Find; use File::Glob ':glob'; use strict; find(\&wanted, "c:/perl58/bin"); #replace with your directory sub wanted { if ((-d $File::Find::name) && ($_ ne ".") && ($_ ne "..")) { my @shtml_files = bsd_glob("*.shtml"); foreach my $shtml_file (@shtml_files) { print $shtml_file; open(SHTMLFILE, "<", $shtml_file); my $buffer; read(SHTMLFILE, $buffer, 10000); #give some big number, wh +ich exceeds the size of all your .shtml files close(SHTMLFILE); $buffer =~ s/<a href="main\.php\?page=(.*?)\"/<a href="mai +n.php?id=$1"/g; open(SHTMLFILE, ">", $shtml_file); close(SHTMLFILE); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Massive File Editing
by chromatic (Archbishop) on Dec 15, 2002 at 06:24 UTC | |
by pg (Canon) on Dec 15, 2002 at 15:54 UTC | |
by chromatic (Archbishop) on Dec 15, 2002 at 22:06 UTC | |
by demerphq (Chancellor) on Dec 15, 2002 at 22:03 UTC |