Re: find

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Oct 6, 2008 at 2:41 AM, Ralph Angenendt <ra+centos@xxxxxxxxxxxx> 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
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux