Finding files containing 'string'
Andy Green
andy at warmcat.com
Wed Feb 1 19:12:29 UTC 2006
Paul wrote:
>>> Interesting gotcha with grep... doesn't look in files beginning with .
>>> when used like this.
>> Huh?
>>
>> $ mkdir testdir
>> $ echo This is a test > testdir/.testfile
>> $ grep -i -r -l this testdir
>> testdir/.testfile
> Methinks Andy is seeing the likes of
>
> $ mkdir testdir
> $ echo This is a test > testdir/.testfile
> $ cd testdir
> $ grep -i -r -l this *
> grep: No match.
Yep youthinks right. The problem is in the glob expansion rather than
grep then because the first recipe does find the .file for me too. Hm
that makes a lot of sense because I noticed this when I saw grep was not
descending into ~/.blah/ when given
cd ~
grep stuff * -R
of course
echo *
doesn't show .files either.
> My favorite..
>
> find . -print | xargs grep -i <string>
>
> Slower, but in my experince, pretty bulletproof.
Time to retrain the old fingers :-)
-Andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4492 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20060201/5fc4425e/attachment-0002.bin
More information about the users
mailing list