This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than without "-i{}"
- To: "Karr, David" <david dot karr at cacheflow dot com>
- Subject: Re: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than without "-i{}"
- From: Dario Alcocer <alcocer at helixdigital dot com>
- Date: Fri, 22 Jun 2001 13:38:30 -0700
- Cc: "'cygwin at cygwin dot com'" <cygwin at cygwin dot com>
- References: <2C08D4EECBDED41184BB00D0B747334202FB44B3@exchanger.cacheflow.com>
>>>>> "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