Grep multiple exclude extension

excludegrepunix

I find single exclude extension like

grep --exclude "*.js" "a" *

How do I write multiple exclude masks?

I have tried the code below, but it doesn't work:

grep -r --exclude=*.\{html,htm,js} "li" *

grep -R -E '(\.js|rb)' "create" * 

Best Answer

You should escape the asterisk, not the curly brace. Your command should look like this:

grep -r --exclude=\*.{html,htm,js} "li" *
Related Question