in reply to Re: remove line break from 1 line
in thread remove line break from 1 line
#!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:/"; # use forward slash, you can use mapped drives. print "changing to $root\n"; chdir $root; my $no_switches=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) { open(xFILE,$_) or die "ERROR: couldn't open file"; my @file = <xFILE>; my $line; foreach $line (@file) { if ($line =~ m/(<meta[\s\r\n\t]+name="revision"[\s\r\n\t]+con +tent=$)/im) { print $line; chomp($line); close (xFILE); $no_switches++; } # end if } $no_files++; } #end if matches filetype else { print "file type not processed\n\n"; } #add $_ if you want + to see URL of file not processed. } # end sub # add timestamp, # files, # matches to log open(LOG, ">H:/Web/perl/log.txt") or die "ERROR: Can't open log.txt"; my $timestamp = localtime(); print LOG "$no_files files - $no_switches matches - $timestamp\n"; foreach(@log) { print LOG; } close (LOG); print "log file updated. $no_files files - $no_switches matches";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: remove line break from 1 line
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 | |
by graff (Chancellor) on Jan 21, 2007 at 06:37 UTC |