Glam Prestige Journal

Bright entertainment trends with youth appeal.

This works for me, in that it excludes the "foo" directory from the root directory of the search:

grep -rn --exclude-dir=foo 'custom'

However this doesn't work:

grep -rn --exclude-dir=foo/bar 'custom'

But the "foo/bar" directory is still searched. I also tried it with quotes:

grep -rn --exclude-dir='foo/bar' 'custom'

I'm using Ubuntu 20.

Update

Although not perfect, I used this workaround instead:

grep -rn 'custom'|grep -v 'foo/bar'

This will fail to find lines that contain both "foo/bar" and "custom".

4 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy