MACSCRPT Archives

April 2008

MACSCRPT@LISTSERV.DARTMOUTH.EDU

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

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

Print Reply
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 25 Apr 2008 00:00:56 -0400
Content-Disposition:
inline
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
In-Reply-To:
Content-Type:
text/plain; charset=UTF-8
From:
"Mark J. Reed" <[log in to unmask]>
Parts/Attachments:
text/plain (25 lines)
On Thu, Apr 24, 2008 at 11:12 PM, David Livesay <[log in to unmask]> wrote:
>  ls notes-* | [??] | cat > notes

Ok, a bit of clarification here.  UNIX is not DOS; it is the *shell*,
not the individual commands like ls, that is responsible for expanding
wildcards.  The shell expands notes-* into individual files and passes
them all to the command; so your ls command above is essentially a
glorified echo command.

cat notes-*

will do what you want.

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.

-- 
Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2