recursive grep

George Robbins grr at cbmvax.UUCP
Tue Aug 29 23:50:10 AEST 1989


In article <1641 at cbnewsl.ATT.COM> ams at cbnewsl.ATT.COM (andrew.m.shaw,580,) writes:
> 
>  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:
>  >
>  >	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.

Iff your system happens to have xargs - many Berkeley derived systems don't,
in which case the "find | filter | sh" can stil handle the problem.  It may
not be as quick, since it does one command per filename, but it's certainly
more flexible.

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr at uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)



More information about the Comp.unix.wizards mailing list