I'm a frequent user of grep. I know that I can recursively search a directory using the -r flag:
// will recursively search all files
grep -r 'some string' *
However, if I want to limit my search to PHP files, the -r flag is suddenly useless:
// for some reason, this only searches the PHP files in the current dir
grep -r 'some string' *.php
Can anyone tell me a good way to recursively search a directory and its subdirs for a string but ONLY look at PHP or HTML files (and possibly TXT files too) ? I'm really hoping for a nice, short command that doesn't involve using an exclude file and which isn't really painful to type. I do this kind of search very frequently and have resorted to either searching EVERY file which is really slow (TAR and ZIP files really slow it down) OR typing repeated commands to search .php, /*.php, etc.