|
I commonly use the following (or something close to it) to rip through third-party source to find something I'm interested in:
find . -name "*.java" -type f | xargs grep someMethod
The problem that I usually run into is that directories will have spaces in the names (xargs treats spaces as delimiters). The trick to getting around this is the following:
find . -name "*.java" -type f -print0 | xargs -0 grep someMethod
The -print0 on find will use null to separate filenames and the -0 on xargs will read them. This article has more information.
And for those of you that are wondering why I have spaces in directories / filenames, A) it's 2005 people, B) I'm developing on Windows where it's more common and C) I'm looking at third-party source (i.e. go b*tch to someone else).
|