delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/12/14/12:35:46

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=V+qVIa+Yxp5GIhu+
0l6lJI0sqM0NBVI6CyiCsQtB7kH99+az5Yo1mhNl1NgKJmpyVhKpEOlZ8PeZ9cbT
SygaMRoJVD91g4fhax1MP7eRaNWcRCEol01n51GVI91xy0HCekavHu+tHP85RrBm
lavsg3UcesDqQhal3ilhezQOnhw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=AbBWU207lbFsCUGPEpk33d
B2noY=; b=jHD5eg7VR6nKNc1zaN5lA6mkiHcxunhyU7btn80cmEzuIU/hrqSVRG
PZgo6DgHkFLxhHeQ6bE0STPXd+DDcn7R+i2sqh0qhK/LXTIfaZ8zQ14av5fMOO1R
7sN0pH2/PdNS6wQn+YpKaHi4wE7k7kUR9u5Sit/aLxTgbdYSUCWvY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=kenneth, Kenneth, wan, H*MI:sk:87h967o
X-HELO: forward3p.cmail.yandex.net
Authentication-Results: smtp1p.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0
Date: Wed, 14 Dec 2016 20:25:49 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <284275774.20161214202549@yandex.ru>
To: "Nellis, Kenneth" <Kenneth DOT Nellis AT xerox DOT com>, cygwin AT cygwin DOT com
Subject: Re: Editors set x-bit (sometimes)
In-Reply-To: <0D835E9B9CD07F40A48423F80D3B5A704BBD4197@USA7109MB022.na.xerox.net>
References: <87h967obmc DOT fsf AT Rainer DOT invalid> <0D835E9B9CD07F40A48423F80D3B5A704BBD4197 AT USA7109MB022 DOT na DOT xerox DOT net>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Nellis, Kenneth!

>> From: Achim Gratz 
>> .. the latter is slightly less efficient and you have to
>> do -print0/-0, but I tend to get it right more easily then the -exec
>> stuff.

> Really? I always thought the opposite. With -exec, doesn't
> find invoke the command for each single found object?

Depends, how do you set the find, and what the net effect you wan to achieve.

> While xargs allows a single command to operate on a whole slew of objects.

Which boils down to executing command every time for each argument.

> For example:
> find ... -exec pgm {} \;
> executes pgm separately for each found object

What about

  find ... -exec pgm '{}' +

?

> while
> find ... | xargs pgm
> invokes pgm only once for as many files as will fit on the
> command line, which is quite a few.

> If I'm wrong about this, please share.

It really depends on what you are doing with find.

find . -iname *.php -execdir grep -qP '(?<=function )funcname' '{}' \; -print

is one thing, but

find . -date +7 -exec mv -t /dir '{}' +

is completely another.

> Or, perhaps we are talking about commands that only take
> a single object. In that case, you would need to say
> xargs -n1
> in which case, I agree, it is less efficient.


-- 
With best regards,
Andrey Repin
Wednesday, December 14, 2016 20:13:08

Sorry for my terrible english...


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

- Raw text -


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