给你一个清理的perl脚本,很好用的:
#!/usr/bin/perl
use File::Find;
sub clean_file {
my $file = shift;
my $tmp = $file.".tmp";
print "clean file $file ...n";
open(FILE, $file) or die "can not open $filen";
open(TMP, ">$tmp") or die "can not open $tmpn";
while(){
my $line = $_;
$line =~ s/^.*aWYoZnVuY3Rpb25fZXhpc.*$/$line =~ s/rn$/n/;
print TMP $line;
}
close(FILE);
close(TMP);
system("mv $tmp $file");
}
sub process {
my $file = $File::Find::name;
if ($file =~/.(php)$/i){
clean_file($file);
}
}
find(&process, '/mnt/html/test...');
注:清理之前注意备份现场,要是脚本有点小问题,到时候就追悔莫及了^_^