in reply to greping for a word
However, if you have access to Unix, then the following shell snippet might be more useful in the long run:use warnings; use strict; use File::Find; my $search_string = "ORA"; find( \&grep, "." ); sub grep { my $file = $File::Find::name; if ( -f $file && -r _ ) { open( my $fh, "<", $file ) or return; while ( my $rec = <$fh> ) { print "Found $search_string in $file" if $rec =~ /$search_string/; } } }
find . -type f | xargs grep -l ORA
thor
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: greping for a word
by jdporter (Paladin) on Apr 29, 2004 at 03:40 UTC | |
by revdiablo (Prior) on Apr 29, 2004 at 04:57 UTC | |
by jdporter (Paladin) on Apr 29, 2004 at 20:03 UTC |