Re: Search certain string in a directory



On Sun, Apr 29, 2007 at 10:54:44PM -0700, Jeff D wrote:

I have a directory and several sub-directory and files reside within
it. I'm wondering is there any command I can use to search for the
certain tring's ocurence? Can any of you help me please?

find ~/tmp/ -type f -exec grep -l mystring {} \;

this will recursivly look for files in ~/tmp/ and print out files that
have mystring in them.

Of course grep has a -R flag for recursive operation ...

grep -R "some regexp" .

or.

rgrep "some string" .

Steve
--


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages