Subject: Re: Recursive grep (where is limfree defined?)
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 01/23/1996 05:40:17
>>> find /usr/src/sys -name '*.c' -exec grep '^limfree' '{}' /dev/null \;

> find /usr/src/sys -name "*.c" | xargs grep '^limfree' /dev/null

> the find ... | xargs ... is:
> 	(1) probably not that much more inefficient,
> 	(2) is portable to any POSIX system,
> 	(3) is more flexible (both because of find's flexibility, and
> 	    because you can do a lot with a pipeline).

(4) broken if any of the located filenames contains characters that
(like newlines) upset xargs.  (My find contains a -print0 option, which
separates output filenames with NULs rather than newlines, specifically
designed to avoid this problem; my xargs doesn't currently have a
corresponding option, but will by the time anyone gets this.)

While newlines are relatively unlikely, standard xargs also gets upset
on a whole lot of other characters, like whitespace(!).  Fortunately
they won't be found either searching the stock /sys tree.  (I'd also
use something faster than grep, at least for the bulk searching.)

					der Mouse