delorie.com/archives/browse.cgi | search |
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 |
From: | Dario Alcocer <alcocer AT helixdigital DOT com> |
MIME-Version: | 1.0 |
Message-ID: | <15155.44230.708143.152353@coyote.priv.helixdigital.com> |
Date: | Fri, 22 Jun 2001 13:38:30 -0700 |
To: | "Karr, David" <david DOT karr AT cacheflow DOT com> |
Cc: | "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com> |
Subject: | Re: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than without "-i{}" |
In-Reply-To: | <2C08D4EECBDED41184BB00D0B747334202FB44B3@exchanger.cacheflow.com> |
References: | <2C08D4EECBDED41184BB00D0B747334202FB44B3 AT exchanger DOT cacheflow DOT com> |
X-Mailer: | VM 6.76 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid |
>>>>> "David" == Karr, David <david DOT karr AT cacheflow DOT 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 AT helixdigital DOT com -- http://www.helixdigital.com -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |