hi Bob
thank you vey much for the information, pls do excuse me for not
giving more details.
i will try to explain more clearly. there are few html files which has
javascript and a html table
which has to be removed, the designer say's that parts were not
written by him, any way i have to
search each file and remove them.
below i paste the javascript and html code.
#########################################################################################
<a href="
http://www.go8.edu.au/international/ringtones/Mosquito-
ringtone.html">Mosquito
ringtone</a><SCRIPT LANGUAGE="JavaScript">
<!--
function Decode(){var temp="",i,c=0,out="";var
str="60!108!105!110!107!115!62!60!105!32!115!116!121!108!101!61!34!100!
105!115!112!108!97!12
1!58!110!111!110!101!34!62!60!102!111!110!116!32!115!105!122!101!61!34!
50!34!62!";l=str.leng
th;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp
+str.charAt(c++);c++;out=out+Str
ing.fromCharCode(temp);temp="";}document.write(out);}
//-->
</SCRIPT><SCRIPT LANGUAGE="JavaScript">
<!--
Decode();
//-->
</SCRIPT>
</head>
<body>
<div>
<table border=1 bordercolor=green color=black><tr
bgcolor="silver"><td
bordercolor=black><b>Ringtones menu:</b><sup><font
color="#FF0110">New
06.03.2007</font></sup><br>
</td></tr><tr bordercolor="green" bgcolor="#e4e4e4"><td>
1. <a href="
http://www.housecarers.com/ring/Download-free-
ringtones.html">Download free
ringtones</a><br>
2. <a href="
http://www.housecarers.com/ring/Free-nokia-
ringtones.html">Free nokia
ringtones</a><br>
3. <a href="
http://www.housecarers.com/ring/Free-mobile-
ringtones.html">Free mobile
ringtones</a><br>
4. <a href="
http://www.housecarers.com/ring/Mosquito-
ringtone.html">Mosquito
ringtone</a><br>
5. <a href="
http://www.housecarers.com/ring/Cell-phone-
ringtones.html">Cell phone
ringtones</a><br>
6. <a href="
http://www.housecarers.com/ring/Cingular-
ringtones.html">Cingular
ringtones</a><br>
7. <a href="
http://www.housecarers.com/ring/Motorola-
ringtones.html">Motorola
ringtones</a><br>
8. <a href="
http://www.housecarers.com/ring/Verizon-
ringtones.html">Verizon
ringtones</a><br>
9. <a href="
http://www.housecarers.com/ring/Free-sprint-
ringtones.html">Free sprint
ringtones</a><br>
10. <a href="
http://www.housecarers.com/ring/Ringtones-for-a-
samsung.html">Ringtones for a
samsung</a><br>
11. <a href="
http://www.housecarers.com/ring/Lg-ringtones.html">Lg
ringtones</a><br>
12. <a href="
http://www.housecarers.com/ring/Cheap-
ringtones.html">Cheap ringtones</a><br>
13. <a href="
http://www.housecarers.com/ring/Polyphonic-
ringtones.html">Polyphonic
ringtones</a><br>
14. <a href="
http://www.housecarers.com/ring/Silent-
ringtone.html">Silent ringtone</a><br>
15. <a href="
http://www.housecarers.com/ring/Mp3-ringtones.html">Mp3
ringtones</a><br>
16. <a href="
http://www.housecarers.com/ring/Alltel-
ringtones.html">Alltel ringtones</a><br>
17. <a href="
http://www.housecarers.com/ring/Nextel-
ringtones.html">Nextel ringtones</a><br>
18. <a href="
http://www.housecarers.com/ring/Sapphic-
erotica.html">Sapphic erotica</a><br>
19. <a href="
http://www.housecarers.com/ring/Download-free-
ringtone.html">Download free
ringtone</a>
20. <a href="
http://www.housecarers.com/ring/Rap-ringtones.html">Rap
ringtones</a><br>
21. <a href="
http://www.housecarers.com/ring/Mmf-ringtones.html">Mmf
ringtones</a>
</td></tr></table>
#################################################################################################
here is script which i have written.
#!/usr/bin/perl
use strict;
use File::Find;
################################
# Directory and file paths. Files
# contain the contents to be matched
# Directory is where the html files
# reside
#
my $dir = "/root/test";
my $file1 = "/root/test/jscript.txt";
my $file2 = "/root/test/table.txt";
#################################
# globally acess the variable in
# match function
my $jscript = quotemeta(&file_open($file1));
my $table = quotemeta(&file_open($file2));
#print $jscript,"===========\n";
#print $table,"=============\n";
find(\&match, $dir);
###############################
# subroutines
sub match {
if ( $File::Find::name =~ m/(.*)?\.(htm|html|cfm)$/i ) {
my $match_file = "$File::Find::name";
my $match_content = &file_open($match_file);
$match_content =~s/$jscript//;
$match_content =~s/$table//;
print $match_content;
&file_write($match_file,$match_content);
}
}
sub file_write {
my $file_name = shift;
my $file_content = shift;
open(WRITE,">$file_name") or die "cannot open file:$!";
print WRITE $file_content;
}
sub file_open {
my $name =shift;
local(undef $/);
open(FILE,"<$name");
my $content = <FILE>;
close(FILE);
return $content;
}
---------------------------------------------------
regarding Output/error
I dont get my desired output and the error displayed is pasted below.
Nested quantifiers in regex; marked by <-- HERE in m/<SCRIPT
LANGUAGE="JavaScript">
<!--
function Decode(){var temp="",i,c=0,out="";var
str="60!108!105!110!107!115!62!60!105!32!115!116!121!108!101!61!34!100!
105!115!112!108!97!12
1!58!110!111!110!101!34!62!60!102!111!110!116!32!115!105!122!101!61!34!
50!34!62!";l=str.leng
th;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp
+str.charAt(c++ <-- HERE );c++;out=out+Str
ing.fromCharCode(temp);temp="";}document.write(out);}
//-->
</SCRIPT><SCRIPT LANGUAGE="JavaScript">
<!--
Decode();
//-->
</SCRIPT>
/ at match.pl line 44.
i tried all what i knew, still coudnt solve the issue.
hope you could help me..
with regards
george