This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xargs still nok?


zzapper wrote:

> Is Xargs still reqd for
> 
> find . -name '*.cfm' -exec grep -i {} \;

It's not required, but using the above you will have to fork() and
exec() an individual copy of grep for each file, which will be
horrendously slow.   If you used xargs, it will call grep with as many
filenames as will fit on one command line, so that grep is actually
invoked as few times as is absolutely necessary.

It's the difference between:

grep -i foo bar00001.c
grep -i foo bar00002.c
...
grep -i foo bar00099.c # grep invoked 100 times

versus

grep -i foo bar00001.c bar00002.c ... bar00050.c
grep -i foo bar00051.c bar00052.c ... bar00099.c # grep invoked twice

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]