delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/08/06/16:06:37

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <20050806200629.44570.qmail@web30208.mail.mud.yahoo.com>
Date: Sat, 6 Aug 2005 13:06:29 -0700 (PDT)
From: Peter Farley <pjfarley3 AT yahoo DOT com>
Subject: Re: Question about coreutils common option "-"
To: cygwin AT cygwin DOT com
In-Reply-To: <42F510B1.947D717C@dessent.net>
MIME-Version: 1.0
X-IsSubscribed: yes

--- Brian Dessent <brian AT dessent DOT net> wrote:
<Snipped> 
> I've never heard of using '-' to ls this way.  The
> coreutils info page does list it as a common flag,
> but my interpretation of the language
> there is that it's only referring to programs that
> act as input/output filters, not as a general-
> purpose way of passing filename arguments. 
> That's why xargs exists.

How to use xargs is a definite hole in my knowledge. 
I have read the xargs info a few times, but I don't
think I have understood it yet.  I will go back to it
and try to get it this time.

> You can get ls-like output from find without any
> other programs:
> 
> find a -daystart -type f -mtime 7 -ls
> 
> If you must use an external program, the usual way
> to take the output from find and send it as
> arguments is with xargs:
> 
> find a -daystart -type f -mtime 7 | xargs ls -l

Yes, I saw that in the info for the find "-ls" option,
but in this case I am going to eventually substitute
another external program for "ls" to process the
filenames in another way.  xargs would seem to be the
correct answer for that, as you noted.

> Note that both this and your '-printf " %p"' method
> will not work for filenames that contain spaces or
> special characters.  Therefore the superior way of
> doing this is:
> 
> find a -daystart -type f -mtime 7 -print0 | xargs -0
> ls -l

Not a problem in this case, the filenames to be
processed are space-less and without any special
characters because of the program that creates them. 
Thanks anyway for the info, I will remember it.

<Snipped> 
> It doesn't work under linux either.  (It's the same
> coreutils code in either case.)

Understood.  Many thanks for reducing my level of
ignorance.

Peter

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
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