Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* Re: Searching for text in a file
@ 2001-05-29 20:54 Bob Harris
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Harris @ 2001-05-29 20:54 UTC (permalink / raw)


[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

In article <3b13fcaa@nubby2.>, Aaron Banks <banks45@yahoo.com> wrote:

X  This may be simple.  I want to search for a certain text string in all files
X  on my system.  How do I do that?

write a simple script:

#!/bin/ksh
find starting_directory -type f -print | while read file
do
    if grep -q "search string" $file
    then
        echo $file
    fi
done

Modify the script as needed.  This script will start searching in
whatever directory you substitue for 'starting_directory', and will
grep each regular file looking for "search string" as specified by you. 
If it finds a file that includes the string, it will display the name
of the file where it was found.

                                        Bob Harris


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-30 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3b13fcaa@nubby2.>
2001-05-29 20:38 ` Searching for text in a file Stuart R. Fuller
2001-05-29 20:38 ` Stuart R. Fuller
2001-05-30 17:22   ` Mario Stargard
2001-05-30  6:24 ` Michael Heiming
2001-05-29 20:54 Bob Harris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox