#author("2017-10-06T16:47:51+09:00","default:kow","kow")
**grep 再帰的に処理時に特定のディレクトリを除外する [#s6e5be7d]
~
- ''syntax:''
~
&color(red,){'' grep -rl --exclude-dir=検索除外ディレクトリ名 検索文字列 検索Path ''};~
&color(red,){'' grep -rl --exclude-dir=./husatto* HageHage ./* ''};
~
~
- ''comment:''~
grepの検索を再帰的に処理するときに特定のディレクトリを除外したい~
~
- ''Example:''
~
#highlight(php:nogutter:collapse){{
#
#tree
.
|-- hage1
| `-- test.txt
|-- hage2
| `-- test.txt
|-- hage3
| `-- test.txt
|-- husatto1
| `-- test.txt
|-- husatto2
| `-- test.txt
|-- husatto3
| `-- test.txt
|-- pika1
| `-- test.txt
|-- pika2
| `-- test.txt
|-- pika3
| `-- test.txt
`-- test.txt
#
#grep -rl HageHage ./*
./hage1/test.txt
./hage2/test.txt
./hage3/test.txt
./husatto1/test.txt <---全部のPathをなめてHitしてしまう
./husatto2/test.txt
./husatto3/test.txt
./pika1/test.txt
./pika2/test.txt
./pika3/test.txt
./test.txt
#
#grep -rl --exclude-dir=./husatto* HageHage ./*
./hage1/test.txt
./hage2/test.txt
./hage3/test.txt <---husatto*のPath内の検索が省かれている
./pika1/test.txt
./pika2/test.txt
./pika3/test.txt
./test.txt
#
#
}}
~
#highlight(end)
~
~
&tag(Linux,grep);
~
~
[[Goto Top Page>/]]
~