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

Bob Byron bbyron at radit.com
Wed Jun 5 10:56:35 CDT 2002


If you want to see the matching lines themselves with the file
name prepended, you can add /dev/null to the search list.  
This makes grep think there is more than one file and has to
distinguish it for you.  If you know a partial filename, such as
the extension, you can add the -name clause to your search.

find / -type f -name '*' -exec grep "some string" /dev/null {} \;

Bob

----- Original Message ----- 
From: "Fred James" <fredjame at concentric.net>
To: <discuss at ntlug.org>
Sent: Wednesday, June 05, 2002 9:42 AM
Subject: [NTLUG:Discuss] searching text in all files for match


> 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




More information about the Discuss mailing list