Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: Grep #1

Open
sirupsen opened this issue Jul 24, 2010 · 5 comments
Open

Examples: Grep #1

sirupsen opened this issue Jul 24, 2010 · 5 comments

Comments

@sirupsen
Copy link

I recall in grep you can do:

$ grep -r pattern

Rather than:

$ grep pattern $(find . | grep -v .svn)

As shown in the examples -- or am I getting something wrong here?

@danlucraft
Copy link
Owner

Yes. But the first one wouldn't exclude svn directories, would it?

@sirupsen
Copy link
Author

Ah -- that might be right -- but who uses SVN anyway?

On a serious note:
--exclude-dir=.svn

@danlucraft
Copy link
Owner

I don't have that option in my grep. But I think I can do --exclude=.svn, possibly.

@sirupsen
Copy link
Author

Possibly -- I'm running grep 2.6.3.

I'm sure --exclude=.svn would work as well; --excude-dir was just more explicit. :)

@taw
Copy link
Contributor

taw commented Jul 27, 2010

grep pattern (find . | grep -v .svn) won't really work:

  • It will die with "Argument list too long" if you're grepping even moderately sized source tree. ARGV limits are puny - 128kB on Linux, 256kB on OSX.
  • It will also fail if you have any funny characters in your paths, where even space is considered funny.

danlucraft pushed a commit that referenced this issue Sep 30, 2013
Add some more file types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants