Reputation: 391
I want to exclude both "*log*"
and ./tags
from grep.
What i do is:
grep -rI "PatternToSearch" ./path --exclude="*log*"
or this:
grep -rI "PatternToSearch" ./path --exclude="tags"
is it possible to merge both exclude patterns in one grep?
Upvotes: 13
Views: 18346
Reputation: 786001
Have another --exclude <pattern>
:
grep -rI "PatternToSearch" --exclude="*log*" --exclude="tags" .
Upvotes: 4
Reputation: 1293
Try below:
grep -rI "PatternToSearch" ./path --exclude={*log*,tags}
Just use "," to separate patterns.
Seems duplicated with how do I use the grep --include option for multiple file types?
Upvotes: 13