the line
\ls -1 | grep -v log | xargs grep -r foobar
partially works except it will also skip the "blog" directory since it also gets excluded by grep -v log
. (the \ls
above is to make ls
not do any alias such as ls -F
)
the line
\ls -1 | grep -v log | xargs grep -r foobar
partially works except it will also skip the "blog" directory since it also gets excluded by grep -v log
. (the \ls
above is to make ls
not do any alias such as ls -F
)
find . -name log -prune -o -type f -print0 |xargs -0 grep foobar
\ls -1 | grep -v ^log$ | xargs grep -r foobar
or
grep --exclude-dir=log -r foobar *
GNU grep has this option:
--exclude-dir=DIR
Exclude directories matching the pattern DIR from recursive searches.
with bash, you can use extglob
shopt -s extglob
grep "foobar" !(log)