delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/11/24/12:47:35

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Matthew Woehlke <mw_triad AT users DOT sourceforge DOT net>
Subject: Re: find . -regex '.*js' -type f -exec md5sum '{}' \\; really slow!
Date: Mon, 24 Nov 2008 11:46:22 -0600
Lines: 25
Message-ID: <ggep9e$f5l$1@ger.gmane.org>
References: <1227540449 DOT 7201 DOT 45 DOT camel AT LxPC35> <F0D7281DAB048B438E8F5EC4ECEFBDDC0337DE68 AT esmail DOT elsag DOT de> <1227542582 DOT 7201 DOT 51 DOT camel AT LxPC35> <1227542941 DOT 7201 DOT 55 DOT camel AT LxPC35>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.16) Gecko/20080723 Fedora/2.0.0.16-1.fc9 Thunderbird/2.0.0.16 Mnenhy/0.7.5.0
In-Reply-To: <1227542941.7201.55.camel@LxPC35>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Bartolomeo Nicolotti wrote:
> but the command
> 
> find . -type f  | xargs md5sum
> 
> has problems with blanks in the name of the files:
> [snip examples]

find . -type f -print0 | xargs -0 md5sum

...tells find to output \0-separated lines instead of \n-separated 
lines, and tells xargs to expect \0-separated args instead of 
whitespace-seoarated args.

(That said, I've always rather wondered why xargs doesn't have a mode to 
expect \n-separated args. There is of course the problem that file names 
might also contain \n (maybe not on 'doze, but on POSIX filesystems they 
can), though for less typing it seems most xargs input tends to be 
line-delineated anyway.

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
Is this thing on?


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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