On 2006-11-09, Stahlman Family <[EMAIL PROTECTED]> wrote:

> I use several different solutions for different scenarios. When a basic or 
> extended regex will do, I use mingw grep, invoked from a Bash script on all 
> of the files in my current "project". ...

>                                                        Note that this Bash 
> script passes the pattern to grep on stdin, which protects it from any sort 
> of DOS or Bash shell escaping. This means I can type the pattern on the Vim 
> command line *EXACTLY* as I wish it to be seen by grep. The importance of 
> this cannot be overstated...

How are you doing this?  Are you using the -f option to grep to pass
the pattern from a file?  Otherwise, I don't see how you can avoid
having the shell see the pattern at some point.

I've always found enclosing the pattern in single quotes to be
sufficient protection when using Cygwin or Unix.

> Originally, my Bash script used xargs to invoke grep, but I found that I 
> could achieve significant execution time savings by running grep on 
> "chunks" of 50-100 files at a time (actual number is an option to the Bash 
> script), rather than running it once per file as was being done with xargs. 

But xargs doesn't give its command argument one file at a time--it 
gives the command as many files as it can, limited by ARG_MAX and 
LINE_MAX.

In the following example,

    $ ls | xarsg echo | wc
           3     360    4719

xargs executed echo three times with an average of 120 file name 
arguments per execution.

Regards,
Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Wireless Division
                             | Spokane, Washington, USA

Reply via email to