Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
From: Dario Alcocer <alcocer@helixdigital.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <15155.44230.708143.152353@coyote.priv.helixdigital.com>
Date: Fri, 22 Jun 2001 13:38:30 -0700
To: "Karr, David" <david.karr@cacheflow.com>
Cc: "'cygwin@cygwin.com'" <cygwin@cygwin.com>
Subject: Re: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than without "-i{}"
In-Reply-To: <2C08D4EECBDED41184BB00D0B747334202FB44B3@exchanger.cacheflow.com>
References: <2C08D4EECBDED41184BB00D0B747334202FB44B3@exchanger.cacheflow.com>
X-Mailer: VM 6.76 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid

>>>>> "David" == Karr, David <david.karr@cacheflow.com> writes:

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

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

    David>    find . -type f | xargs -n100 -i{} grepf searchstring
    David> "{}" <...snip...>

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

Well, I don't know about more "efficient", but there is a better way:

    $ find . -type f -print0 | xargs -0 grepf searchstring

This command-line will use nulls instead of whitespace to separate the
filenames.  Refer to the manual pages for find(1) and xargs(1) for
more information regarding the -print0 and -0 options.  This approach
is what I use whenever I need to process files in the "C:\Program
Files" directory.

Hope this helps,

-- 
Dario Alcocer -- Sr. Software Developer, Helix Digital Inc.
alcocer@helixdigital.com -- http://www.helixdigital.com

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

