On Mon, Oct 6, 2008 at 2:41 AM, Ralph Angenendt ra+centos@br-online.de wrote:
Akemi Yagi wrote:
Sorry, I missed the "!" in the above paste:
find . -type f -exec grep -il !* {} ; -exec grep -i !* {} ; -exec echo ;
If you are using GNU grep (well, you are using CentOS),
grep -ri "foo" dir/to/search/in
seems much shorter to me.
This works unless you are looking to search a specific set of files by name, not just whole directories.
I routinely use searches like this to locate patterns in build trees, but I typically only want to look in header or c source files (or sometimes just the Makefiles. In my case, the find...grep form works better because there may not be any of the files I want in the directory from which I begin the search, only those farther down.
Cheers.
mhr