Forum Moderators: coopster
@files = `find /your/path -name '*.html'`;
foreach $sing(@files) {
chomp $sing;
my $replace;
if(! -s($sing)) {
print "OOPS.. file [$sing] does not exist..\n";
next;
}
my $cont = `cat $sing`;
if($cont =~ /\<h1\>([^\<]+)\<\/h1\>/is) {
$replace = $1;
}
else {
print "OOPS.. in file [$sing] no h1 tag..\n";
next;
}
if(($cont =~ s/(\<title\>)[^\<]+(\<\/title\>)/$1$replace$2/is)<1){
print "OOPS.. in file [$sing] no title tag..\n";
next;
}
open(W, ">$sing");
print W $cont;
close W;
}
print "DONE\n";
exit 0;
-cminblues
[edited by: jatar_k at 5:03 am (utc) on June 18, 2003]
[edit reason] disabled smilies [/edit]