[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limits of grep?



On Wed, 27 Sep 2000, Omer Musaev wrote:

> 
> 
> Shaul Karl wrote:
> 
> > Then xargs won't work either, will it?
> >
> 
> xargs has flags -n , -l , -s to limit amount od args xargs execs each time.
> Thus, having find . -name "*"| xargs -n 500  , and assuming that find will return
> 654 file names, xargs will run _twice_, one time with 500 args, second time with 154
> 
> However, more elegant (IMHO) solution is not to use find and xargs at all, but
> instead use :
> 
> ls| while read file_name ; do grep pattern $filename ; done
> (shsyntax used )

Which is equivalent to:

find . -maxdepth 1 -exec grep pattern {} \;

similar to what Shachar has sugested in the first place

-- 
Tzafrir Cohen
mailto:tzafrir@technion.ac.il
http://www.technion.ac.il/~tzafrir



=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il