bash - Logical OR in GLOB during grep --include/--exclude -
in ubuntu terminal, grep files (or excluding) extension .foo , .bar phrase 'foobar'.
i've read this advice creating glob logical or, , tried few combinations none seem work:
rgrep "foobar" --include "*.foo|*.bar" rgrep "foobar" --include "*.{foo,bar}" rgrep "foobar" --exclude "(*.foo|*.bar)" what's secret recipe?
you can use extglob pattern here:
shopt -s extglob grep 'foobar' *.@(foo|bar) for using recursive grep --include have use glob patterns only:
grep -r 'foobar' --include=*.{foo,bar} .
Comments
Post a Comment