grep で特定のディレクトリを除外する。
‘--exclude-dir=dir’ Exclude directories matching the pattern dir from recursive directory searches.
で、コレを使って、次のようにコマンドを実行すれば、ディレクトリ除いた結果を取得できる
grep -R --exclude-dir=node_modules 'some pattern' /path/to/search
だそうです。
include のディレクトリは使うことが殆ど無いだろうけど、exclude でディレクトリを除外するのはメッチャ使いそう。
logs とか、.git を除外してると便利そうですねー
参考資料
http://stackoverflow.com/questions/6565471/how-can-i-exclude-directories-from-grep-r
See File and Directory Selection for description and grep --exclude/--include syntax (do not grep through certain files) for a bit more information regarding syntax and usage.