recursive grep
andrew.m.shaw
ams at cbnewsl.ATT.COM
Sun Aug 27 07:05:27 AEST 1989
In article <666 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
>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 :-)
Since my previous posting may have gotten lost, I resend that I recommend
the following:
find . -type f -print | xargs fgrep string
Neat and clean.
Andrew Shaw
More information about the Comp.unix.wizards
mailing list