[NTLUG:Discuss] searching text in all files for match

Rick Moncello rmoncello at attbi.com
Wed Jun 5 11:01:13 CDT 2002


OK, let me through in my $0.02 and add a fourth way. . .

grep -r -I "text" /

Rick.

-----Original Message-----
From: discuss-admin at ntlug.org [mailto:discuss-admin at ntlug.org]On Behalf
Of Fred James
Sent: Wednesday, June 05, 2002 10:47 AM
To: discuss at ntlug.org
Subject: Re: [NTLUG:Discuss] searching text in all files for match


That makes 3 lovely ways to do it - Thanks all!

Recap:
find . -type f | xargs file | grep -i text | cut -f1 -d: | xargs grep 
"search for this"

find / -type f -print -exec fgrep "text to find" {} \;


find . -exec grep -l 'text to search for' {} \;



Alton R. Pouncey, II wrote:

> On Wed, 2002-06-05 at 09:42, Fred James wrote:
> 
>>My brain is stuck - trying to remember how to search all text files on 
>>the machine for matches to a text string.  Any nudges?
>>
>>-- 
>>"Wisdom begins in wonder." - Socrates
>>
>>
>>_______________________________________________
>>http://www.ntlug.org/mailman/listinfo/discuss
>>
>>
> 
> find . -exec grep -l 'text to search for' {} \;
> 
> 


-- 
"Wisdom begins in wonder." - Socrates


_______________________________________________
http://www.ntlug.org/mailman/listinfo/discuss




More information about the Discuss mailing list