MACSCRPT Archives

April 2008

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Baxter <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 25 Apr 2008 07:53:57 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (20 lines)
On Apr 24, 2008, at 9:00 PM, Mark J. Reed wrote:

> However, there are cases where you want to take a list of filenames
> (or other strings) in one-per-line form and turn them into arguments
> to a single command; that's what the xargs (cross-arguments) command
> is for:
>
> ls -1 notes-* | xargs cat
>
> will also do the right thing.

And, if the total number of qualifying files is (or might become large  
while you're skiing in the alps in a couple of years) "large", using  
xargs is necessary, as command lines (after expansion) are not  
infinitely long.  xargs batches its calls to the program it is  
calling, if the maximum would be exceeded or as controlled by  
parameters.  "large" varies as the limit is length not count.

   --John

ATOM RSS1 RSS2