recursive grep
David Goodenough
dg at lakart.UUCP
Thu Aug 24 23:43:43 AEST 1989
steve at polyslo.CalPoly.EDU (Steve DeJarnett) sez:
> williamt at 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 at lakart.UUCP - David Goodenough +---+
IHS | +-+-+
....... !harvard!xait!lakart!dg +-+-+ |
AKA: dg%lakart.uucp at xait.xerox.com +---+
More information about the Comp.unix.wizards
mailing list