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-30 10:25:49 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!east1.newsfeed.sprint-canada.net!news.storm.ca!not-for-mail From: Mario Stargard Newsgroups: comp.unix.tru64 Subject: Re: Searching for text in a file Date: Wed, 30 May 2001 13:22:09 -0400 Organization: Storm Internet Services Sender: mario@dp02-209-87-225-69.ottawa.storm.ca Message-ID: <3B152C41.4F4898CA@hotmail.com> References: <3b13fcaa@nubby2.> <3s01f9.i9n.ln@momsys.fuller.local> NNTP-Posting-Host: dp02-209-87-225-69.ottawa.storm.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.storm.ca 991243548 15589 209.87.225.69 (30 May 2001 17:25:48 GMT) X-Complaints-To: abuse@storm.ca NNTP-Posting-Date: 30 May 2001 17:25:48 GMT X-Mailer: Mozilla 4.72 [en] (Win95; U) X-Accept-Language: en Xref: archiver1.google.com comp.unix.tru64:2352 "Stuart R. Fuller" wrote: > > Aaron Banks wrote: > : This may be simple. I want to search for a certain text string in all files > : on my system. How do I do that? > > find / | xargs grep my-string > > Stu You've not guaranteed that grep will get more than one argument and so won't return the filename in some instances. Also you can really speed things up by just looking in text files. grepping through binaries, especially oracle dbf's can be time consuming. find . -type f |xargs file |awk -F: '$NF ~ /text/{ print $1 }' |xargs grep my-string /dev/null Mario