Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!usc!ucsd!ucbvax!decwrl!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.wizards Subject: Re: recursive grep Message-ID: <666@lakart.UUCP> Date: 24 Aug 89 13:43:43 GMT References: <13710@polyslo.CalPoly.EDU> Organization: Lakart Corporation, Newton, MA Lines: 24 steve@polyslo.CalPoly.EDU (Steve DeJarnett) sez: > williamt@sun.UUCP (William A. Turnbow) writes: >>Here is a short quicky (I hope). I am trying to do the following: >> >>find . -type d -exec grep string {}/* \; > > If you're trying to grep for a string in every file in or below the > current directory, why not do this: > > find . -type f -exec grep string {} \; Simple. The first does one exec per directory, the second does one exec per file. I agree with Mr. Turnbow that it is extremely obnoxious behaviour on the part of find. The only way I can see to do it is to do some real funky work with awk, maybe: find . -type d -print | awk '{ print "grep string " $0 "/*" }' | sh But then I use awk for most everything, no matter how ugly :-) -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+