Search code examples
grep

Flag --include in grep does not accept numerous entries


source: https://stackoverflow.com/a/221929/22132012

Why is it possible to use:

grep -rinHI --exclude={\*.h} pattern

And:

grep pattern -r --include=\*.cpp --include=\*.h rootdir

Both statements above print the expected results. But this command does not print anything:

grep -rinHI --include={\*.h,\*.cpp} pattern

Solution

  • The solution is, as @Eric pointed out in the comments:

    grep -rinHI --include=\*.{h,cpp} pattern