Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I need to go through large directories and search all the Perl scripts for the word "email" in them. But I cant get the command to search recursively, it works if I specify a directory, but even using "-r" it is not doing what I expected. Here is the code, if anyone would give me a better way it would be really nice.
dir1/dir2/dir3/ file1.pl:230 email
dir_a test.pl:44 email
If anyone has done something like that and would like to share some knowledge it would help me a lot! Thanks!
I need to go through large directories and search all the Perl scripts for the word "email" in them. But I cant get the command to search recursively, it works if I specify a directory, but even using "-r" it is not doing what I expected. Here is the code, if anyone would give me a better way it would be really nice.
This other code its actually better because it gives me the line number where it found the word "email", but again it cant search recursively through all directories. It would be nice if I could get with this:grep -H -r "mail" mydirectory/*.pl > res/results.txt
A file with results something like:find /start_dir -name *.pl -exec grep -i -H -n 'email' {} > res/resu +lts.txt\;
dir1/dir2/dir3/ file1.pl:230 email
dir_a test.pl:44 email
If anyone has done something like that and would like to share some knowledge it would help me a lot! Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl and or Grep Help!
by Corion (Patriarch) on Jan 17, 2011 at 20:28 UTC | |
by FalseVinylShrub (Chaplain) on Jan 18, 2011 at 11:08 UTC | |
Re: Perl and or Grep Help!
by Anonyrnous Monk (Hermit) on Jan 17, 2011 at 20:48 UTC | |
Re: Perl and or Grep Help!
by rir (Vicar) on Jan 17, 2011 at 20:29 UTC | |
Re: Perl and or Grep Help!
by oko1 (Deacon) on Jan 17, 2011 at 23:45 UTC | |
by Anonymous Monk on Jan 18, 2011 at 14:56 UTC | |
by Anonymous Monk on Jan 18, 2011 at 15:50 UTC | |
by Anonymous Monk on Jan 18, 2011 at 15:19 UTC | |
Re: Perl and or Grep Help!
by rir (Vicar) on Jan 17, 2011 at 20:31 UTC |
Back to
Seekers of Perl Wisdom