http://qs321.pair.com?node_id=882744

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.
grep -H -r "mail" mydirectory/*.pl > res/results.txt
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:
find /start_dir -name *.pl -exec grep -i -H -n 'email' {} > res/resu +lts.txt\;
A file with results something like:
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!