[EMAIL PROTECTED] wrote:
Here's another way, but not necessarily the best Perl, but it does work:
#!/usr/bin/env perl
use strict;
use warnings;
my @filelist=<STDIN>;
chomp @filelist;
my $match_strings=qr '(abc123blue|xyz357green)';
my ($file, );
foreach $file (@filelist) {
#print "file=$file\n";
Is that # supposed to be there?
open(FD,"<$file") or die "Cannot open $file\n";
my $iline;
while ($iline=<FD>) {
chomp $iline;
print "$file\n" if ($iline =~ /$match_strings/);
}
close FD;
}
Unfortunately the script is hanging :-(
I didn't really want to get into supplying a list of filenames to the
script (so tested this on one file). Although I am only going to be
working on a small number of folders, they could very easily contain
hundreds if not thousands of files.
I had a load of scripts that I had written when I first had a go at
learning PERL a couple of years ago, but due to a system crash, I lost
almos all of them, and find myself back at square one, only this time I
am trying to achieve my goals without asking tons of Q's.
Thanks
Brian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/