这条线
\ls -1 | grep -v log | xargs grep -r foobar部分工作,除非它还将跳过“博客”目录,因为它也被grep -v log排除在外。(上面的\ls是为了让ls不做任何别名,比如ls -F)
发布于 2010-10-14 04:16:24
\ls -1 | grep -v ^log$ | xargs grep -r foobar或
grep --exclude-dir=log -r foobar *发布于 2010-10-14 04:06:42
find . -name log -prune -o -type f -print0 |xargs -0 grep foobar发布于 2010-10-14 04:31:07
GNU grep具有以下选项:
--exclude-dir=DIR
Exclude directories matching the pattern DIR from recursive searches.https://stackoverflow.com/questions/3927543
复制相似问题