Path: utzoo!utgpu!watserv1!watmath!att!att!bu.edu!transfer!lectroid!atrain!bad From: bad@atrain.sw.stratus.com (Bruce Dumes) Newsgroups: comp.unix.questions Subject: Re: grep Message-ID: <2822@lectroid.sw.stratus.com> Date: 23 Oct 90 17:43:54 GMT References: <1990Oct23.123025.18012@kodak.kodak.com> Sender: usenet@lectroid.sw.stratus.com Organization: Stratus Computer, Inc. Lines: 41 In article thomas@uppsala.telesoft.se (Thomas Tornblom) writes: >In article <1990Oct23.123025.18012@kodak.kodak.com> tiefel@sunshine.Kodak.COM (Lenny Tiefel) writes: > > > I have a main directory with hundreds of subdirectories, > and I want to find a file with a particular string, say "xyz" > The grep command only works in one directory at a time. Is there > a way of searching my whole directory structure to find a file > with a particular string? > > Thanks. > >find -type f -name '*xyz*' -print > >Thomas I don't think this is what Lenny was asking for. I think "xyz" is a string *IN* the file, not in the file name. I have a little script called "locate_string". -------------------- cut --------------------------------------------- # # Written by Bruce Dumes Sept 1990 # if test ! "$2" then echo "Usage: locate_string search_dir string" exit fi temp=`find $1 -name "*" -type f -print` grep $2 $temp -------------------- cut --------------------------------------------- Bruce -- Bruce Dumes | "You don't see many of *these* nowdays, | bad@zen.cac.stratus.com | do you?" |