Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!duke!bet From: bet@orion.mc.duke.edu (Bennett Todd) Newsgroups: comp.unix.wizards Subject: Re: recursive grep Message-ID: <15560@duke.cs.duke.edu> Date: 12 Sep 89 02:59:22 GMT References: <13710@polyslo.calpoly.edu> <144000002@cdp> <2390@auspex.auspex.com> <2403@wyse.wyse.com> <2434@auspex.auspex.com> <899@ecijmm.UUCP> Sender: news@duke.cs.duke.edu Reply-To: bet@orion.mc.duke.edu (Bennett Todd) Organization: Diagnostic Physics, Radiology, DUMC Lines: 25 In-reply-to: jmm@ecijmm.UUCP (John Macdonald) The original poster asked for a straightforward construct to let him run a "find . -type d ..." invoking "grep {}/*" for each directory found. Other worthwhile suggestions have been offered which probably work better for what he probably had in mind; however, I am surprised no one mentioned the straightforward find . -type d -print | while read dir;do grep string $dir/* done I don't know any way to do that sort of thing under C-shell, but Bourne shell and successors handle it fine. There is this incredible feeling of power in being able to type oifs=IFS IFS=":" while read login passwd uid gid tail;do # some processing for all the logins on the system done