grep 多重排除扩展

Vya*_*nov 2 unix grep exclude

我发现单个排除扩展名

grep --exclude "*.js" "a" *
Run Code Online (Sandbox Code Playgroud)

如何编写多个排除掩码?

我已经尝试了下面的代码,但它不起作用:

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

grep -R -E '(\.js|rb)' "create" * 
Run Code Online (Sandbox Code Playgroud)

pop*_*tea 12

你应该避开星号,而不是花括号。您的命令应如下所示:

grep -r --exclude=\*.{html,htm,js} "li" *
Run Code Online (Sandbox Code Playgroud)