delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/06/21/16:20:36

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <2C08D4EECBDED41184BB00D0B747334202FB44B3@exchanger.cacheflow.com>
From: "Karr, David" <david DOT karr AT cacheflow DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than wi
thout "-i{}"
Date: Thu, 21 Jun 2001 11:36:34 -0700
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

I work on a project where some of the files and directories were created
with spaces in them.  That will eventually be rectified, but it's hard to
say when (we use a CM system that doesn't make this easy to deal with).

I often find that I have to do "find | grep" operations.  I realized I
couldn't get this to work unless I did something like this:

   find . -type f | xargs -n100 -i{} grepf searchstring "{}"

I use "-n100" to try to make it somewhat more efficient than starting a
process for each line, although I still need to pay attention to
command-line length limits.  The combination of '-i{}' and '"{}"' makes it
so that directories with spaces in them will be handled correctly.  Without
that, "grep" tries to search in the wrong directories (or nonexistent
directories, most likely).

This works.  However, I accidently discovered that using "-i{}" essentially
causes my "-n100" option to be ignored.  When I changed my "command" to just
prepend "echo" to the command line, I found it was executing one command for
each file, as opposed to one command for each 100 files.  This considerably
slows down my tree searches.

Is there any way to get back my more efficient command line, while still
working with my annoying "spacy" directories?

I was actually able to repeat this on both Cygwin and a Linux system, so
perhaps this is "defined" behavior.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019