[CentOS] find

Akemi Yagi amyagi at gmail.com
Fri Oct 3 14:24:41 UTC 2008


On Fri, Oct 3, 2008 at 6:54 AM, Bo Lynch <blynch at ameliaschools.com> wrote:
> On Fri, October 3, 2008 10:00 am, tony.chamberlain at lemko.com wrote:
>>
>> I am looking for something similar to the windows SEARCH FILES comman
>> with the option "files containing ..." (that is where I can specify a
>> string and it will find all files containing that string -- not just
>> having
>> the string as part of the name but actually containing it in the text).
>>
>> Is there some way to do this?
>
> I would recommend taking a look at grep. THere are many ways you can use it.

One such example is:

find . -type f -exec grep -il !* {} \;  -exec grep -i !* {} \; -exec echo \;

alias it to, say, findword and run:  findword <text>

It will show the file names as well as the lines that contain the text.

Akemi


More information about the CentOS mailing list