From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,61cf2d9236bdd2b6 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-05-29 13:54:09 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!crtntx1-snh1.gtei.net!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!news.cpqcorp.net!harris Subject: Re: Searching for text in a file From: Bob Harris Newsgroups: comp.unix.tru64 Posted-And-Mailed: yes Message-ID: <290520011654086821%harris@zk3.dec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 8bit User-Agent: YA-NewsWatcher/5.0.1 Date: Tue, 29 May 2001 16:54:08 -0400 NNTP-Posting-Host: 16.140.32.194 X-Complaints-To: abuse@Compaq.com X-Trace: news.cpqcorp.net 991169648 16.140.32.194 (Tue, 29 May 2001 13:54:08 PDT) NNTP-Posting-Date: Tue, 29 May 2001 13:54:08 PDT Organization: Compaq Computer Corporation Xref: archiver1.google.com comp.unix.tru64:2340 [[ This message was both posted and mailed: see the "To," "Cc," and "Newsgroups" headers for details. ]] In article <3b13fcaa@nubby2.>, Aaron Banks 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