以下の内容はhttps://takuya-1st.hatenablog.jp/entry/2015/09/07/140000より取得しました。


grep で特定のディレクトリを外す/無視するフォルダを指定

grep で特定のディレクトリを除外する。

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.

関連資料

特定の拡張子(*.php)のファイルだけをGrepして検索したい。 - それマグで!

grepで逆検索 (マッチするモノを除外)でマッチしないものを探す - それマグで!




以上の内容はhttps://takuya-1st.hatenablog.jp/entry/2015/09/07/140000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14