Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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


Comment on Re: traverse directory recursively and search for pattern
Download Code

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 meditating upon the Monastery: (4)
As of 2014-10-25 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls