Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: traverse directory recursively and search for pattern

by Anonymous Monk
on Mar 20, 2013 at 07:32 UTC ( #1024460=note: print w/ replies, xml ) Need Help??


in reply to traverse directory recursively and search for pattern

ack --nobinary --match "PATTERN" directory directory

use File::Find::Rule;

my @specs = ( qr/pattern/i, [ qr/notpattern/i ], \&oneline ); find( file => ascii => exec => \&onename, grep => \@specs, in => \@dirs, ); sub onename { my( $shortname, $path, $fullname )= @_; $_ = $shortname; 1; } sub oneline { my( $shortname, $path, $fullname )= @_; my $line = $_; 1; }

http://search.cpan.org/perldoc/Path::Iterator::Rule#SEE_ALSO

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2016-06-27 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (335 votes). Check out past polls.