Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!mcsun!hp4nl!phigate!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.unix.wizards Subject: Re: recursive grep Message-ID: <1087@philmds.UUCP> Date: 12 Sep 89 10:49:41 GMT References: <13710@polyslo.calpoly.edu> <144000002@cdp> <2390@auspex.auspex.com> <2403@wyse.wyse.com> <2434@auspex.auspex.com> <899@ecijmm.UUCP> <15560@duke.cs.duke.edu> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 48 In article <15560@duke.cs.duke.edu> bet@orion.mc.duke.edu (Bennett Todd) writes: |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 whether the original poster (who?) posted his question too to comp.unix.questions, 'cause quoting myself: |From leo Fri Sep 8 12:56:11 MET DST 1989 |Article 14005 of comp.unix.questions: |Path: philmds!leo |>From: leo@philmds.UUCP (Leo de Wit) |Newsgroups: comp.unix.questions |Subject: Re: find cannot find all files in a directory |Keywords: find files directory |Message-ID: <1082@philmds.UUCP> |Date: 7 Sep 89 05:53:20 GMT |References: <874@wubios.wustl.edu> |Reply-To: leo@philmds.UUCP (Leo de Wit) |Organization: Philips I&E DTS Eindhoven |Lines: 13 | |In article <874@wubios.wustl.edu> david@wubios.wustl.edu (David J. Camp) writes: ||I want find to return all the files in each directory to exec. That is, ||I want to do something like: || || find /path -type d -exec command {}/\* \; -print || ||so that command will be run on each file, one directory at a time. | |If you don't have xargs, how about: | | find /path -type d -print|while read dir; do command $dir/*; done | | Leo. | So there _was_ prior art, Bennett, though you'll probably have missed it. Leo.