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? > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >I would recommend taking a look at grep. THere are many ways you can use it. Bo
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?
tony.chamberlain at lemko.com ?rta:> 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?exec + *grep ? t
tony.chamberlain at lemko.com a ?crit :> 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? >grep is your friend. Let's say you are looking for the character string 'UserDir' below your /etc directory. Then you would simply do: [root at grossebertha ~]# grep -R UserDir /etc/ Give it a try! Niki
tony.chamberlain at lemko.com schrieb:> 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? > >You could use "glimpse" for that. Or google desktop ;-) The problem is that preparing the index takes a lot of time. And more than 95 time out of 100, you don't need it anyway. (On a server, because man -k and locate already do a good job of making the relevant stuff available to you quickly). Rainer
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? >Under KDE, there is the "Find Files/Folders" option on the main menu that will do exactly this, or did you want something from the command line? I don't use gnome, but I would expect it to have something similar.
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 tend to use a combination of 'find' and 'grep'. It looks something like this: find . -type f -name '*.txt' | xargs grep 'whatever' Add the '-l' option to grep if you just want a list of the filenames. -- Bowie
MHR wrote:> On Fri, Oct 3, 2008 at 7:27 AM, Akemi Yagi <amyagi at gmail.com> wrote: > > On Fri, Oct 3, 2008 at 7:24 AM, Akemi Yagi <amyagi at gmail.com> wrote: > > > On Fri, Oct 3, 2008 at 6:54 AM, Bo Lynch > > > <blynch at ameliaschools.com> wrote: > > > > > > > > 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> > > > > Sorry, I missed the "!" in the above paste: > > > > find . -type f -exec grep -il \!* {} \; -exec grep -i \!* {} \; > > -exec echo \; > > I tend to do this: > > find . -type f -exec grep <pattern> /dev/null {} \; > > The "/dev/null" is because grep doesn't show the file name unless > there are at least two provided, and this accomplishes what Akemi's > command above does but in a single command. Of course, it still takes > forever if the directory whence the search begins is /.Or you can do it like this: find . -type f -exec grep -H <pattern> {} \;>From the man page:-H, --with-filename Print the filename for each match. -- Bowie