> -----Original Message----- > From: Brian Volk [mailto:[EMAIL PROTECTED] > Sent: Monday, April 04, 2005 11:30 AM > To: Beginners (E-mail) > Subject: Regexp::Common > > > Hi All, > > I have a directory of .txt files, a couple thousand and I > want to pull out > all the files that have "descriptions/product/MSDS" hard coded in the > document. Is this possible to do w/ Regexp::Common? Here is > what I have so > far... > > > ---begin > > use strict; > use warnings; > use Regexp::Common; > > my $dir = "J:/flash_host/ecomm/descriptions/product/small"; > > opendir (SMALL, $dir) or die "Can't open $dir: $!"; > > @ARGV = map { "$dir/$_" } grep { !/^\./ } readdir SMALL; > > open SAVESTDOUT, ">>C:/perl/bin/output/stored_msds.txt" > or die "Open failed"; > > my $regex = "descriptions/product/MSDS"; > > while (<>) { > print SAVESTDOUT "$ARGV $1\n" > and close(ARGV) and next > if /RE =~ {$regex}{-keep}/; > } > > closedir (SMALL); > close SAVESTDOUT; > > --end > Sorry to respond to my own post.. but I think I figured it out... I used /$RE{list}{conj}{-word=>
--begin use strict; use warnings; use Regexp::Common qw /list/; my $dir = "C:/Perl/bin/output/small"; opendir (SMALL, $dir) or die "Can't open $dir: $!"; @ARGV = map { "$dir/$_" } grep { !/^\./ } readdir SMALL; open SAVESTDOUT, ">>C:/perl/bin/output/stored_msds.txt" or die "Open failed"; while (<>) { print SAVESTDOUT "$ARGV $1\n" and print "$ARGV $1\n" and close(ARGV) and next if /$RE{list}{conj}{-word=>'descriptions'}{-keep}/; } closedir (SMALL); close SAVESTDOUT; --end Thanks! Brian Volk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>