rak
rak copied to clipboard
Examples: Grep
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?
Yes. But the first one wouldn't exclude svn directories, would it?
Ah -- that might be right -- but who uses SVN anyway?
On a serious note: --exclude-dir=.svn
I don't have that option in my grep. But I think I can do --exclude=.svn, possibly.
Possibly -- I'm running grep
2.6.3.
I'm sure --exclude=.svn
would work as well; --excude-dir
was just more explicit. :)
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.