Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Nov 2003 18:32:48 -0800 (PST)
From:      Viktor Lazlo <viktorlazlo@telus.net>
To:        Dan Busarow <dan@dpcsys.com>
Cc:        FreeBSD Questions List <questions@freebsd.org>
Subject:   Re: Recursion with grep?
Message-ID:  <20031113183118.T3617@d66-183-123-52.bchsia.telus.net>
In-Reply-To: <Pine.BSF.4.21.0311131524240.1234-100000@java2.dpcsys.com>
References:  <Pine.BSF.4.21.0311131524240.1234-100000@java2.dpcsys.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 13 Nov 2003, Dan Busarow wrote:

> On Nov 13, Francisco Reyes wrote:
> > The man page for grep says to use "-r" to recurse, yet when I try
> > something like
> >
> > grep -r -li string *.c
>
> find . -name "*.c" -exec grep -li string {} \;

If there are a large number of files this will call grep numerous
times--it would be more efficient to pass to xargs so grep is only called
a few times:

find . -type f -print | xargs grep options string

Cheers,

Viktor



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031113183118.T3617>