"Perl.Org" wrote: > > Can anyone share a script that recurses a filesystem for files containing one > or more patterns? Seems like it would be easy to write but if it's already > out there...
This will probably work: #!/usr/bin/perl use warnings; use strict; use File::Find; my $dir = shift || '.'; $/ = \2_048; # set buffer size to 2,048 bytes, YMMV find( sub { local @ARGV = $File::Find::name; my $last = ''; while ( <> ) { $_ = $last . $_; if ( /pattern1/ or /pattern2/ or /pattern3/ ) { print "$ARGV\n"; close ARGV; return; } $last = $_; } }, $dir ); __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>