grep directory exclusion
Posted on 2007-03-20
I want to be able to find matched text in only php files with grep and exclude it from looking in certain directories, or tell it a list of directories to only look in.
If it recurses down into one of my directories that contains 100,000+ files it just takes forever to be useful.
Right now I can only do this by running grep 3 times like:
grep "textToMatch" *.php
grep "textToMatch" inc/*.php
grep "textToMatch" lib/*.php
--include and --exclude seem to be for files and not directories, it will still recurse into my large directory and take hours to complete.
Is there one command to do it it all? I'm running linux fedora 5.