djbryson has asked for the wisdom of the Perl Monks concerning the following question:
#!C:\Perl\bin\perl.exe use strict; use File::Find; use File::Slurp; use Time::Local; print "\nRunning find-slurp_search-within.pl... \n\n"; my $root = "C:/"; print "changing to $root\n"; chdir $root; my $no_switch=0; my $no_files=0; my @log = (); my $dir; # find (\&Wanted, "department", "managers", "mybranch", "mycity", "myi +nfo", "resources"); find (\&Wanted, "working"); #directories - comman delimited sub Wanted { print "*Processing: $root$File::Find::name \n"; if ($_ =~ /\.htm(l)?$/i) { my $file_slurp = read_file("$root$File::Find::name"); if ($file_slurp =~ m/(<meta[\s\r\n\t]+name="revision"[\s\r\n\t]+con +tent=[\s\r\n\t]+)/i) { chomp($file_slurp); # remove line break open(FILE, ">$root$File::Find::name") or die "ERROR: Can't ope +n $root$File::Find::name"; print FILE "$file_slurp"; close (FILE); print "file overwritten\n"; push @log,"$root$File::Find::name \n\n"; $no_switch++; } $no_files++; } #end if matches filetype else { print "file type not processed\n\n"; } #add $_ if you want t +o see URL of file not processed. } # end sub
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: remove line break from 1 line
by liverpole (Monsignor) on Jan 19, 2007 at 18:48 UTC | |
by Anonymous Monk on Jan 19, 2007 at 18:58 UTC | |
by liverpole (Monsignor) on Jan 19, 2007 at 19:02 UTC | |
by djbryson (Beadle) on Jan 19, 2007 at 19:23 UTC | |
by djbryson (Beadle) on Jan 19, 2007 at 19:30 UTC | |
by djbryson (Beadle) on Jan 19, 2007 at 20:02 UTC | |
| |
|
Re: remove line break from 1 line
by jettero (Monsignor) on Jan 19, 2007 at 18:47 UTC | |
by chargrill (Parson) on Jan 20, 2007 at 06:11 UTC |