Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Catenate

Tool

SYNTAX

Catenate [file1] [file2]…

DESCRIPTION

The Catenate command concatenates one or more files by reading the data fork of each file in sequence and writing it to standard output. When used with output redirection, this command allows you to merge multiple text files into a single file.

WARNING
If you specify one of the input files as the output file by using output redirection (>outputFile), Catenate erases the original data in the input file before the redirection takes places. You cannot recover the lost data. To append one file to another, use the form in this example:

Catenate File2 >> File1

INPUT

Standard input, unless you specify input files.

OUTPUT

Standard output.

STATUS

Catenate can return the following status codes:

0

no errors

1

one or more files not found

2

read-write error

PARAMETERS

[file1] [file2]…

Specifies the input files to be concatenated.

OPTIONS

None

EXAMPLES

The MPW Shell writes Makefile.a to the active window immediately following the command line below:

Catenate Makefile.a

Unlike the command line above, the following command line concatenates two files, File1 and File2, and places the result in CombinedFile.

Catenate File1 File2 > CombinedFile

Note
If CombinedFile does not exist, Catenate creates it. However, if CombinedFile already exists, Catenate writes the concatenation of File1 and File2 over its previous contents. •

The following command line captures the selection expression (§) from the target window in the MPW Shell variable {selection}.

Set selection "`Catenate §`"

If you do not specify any input files, Catenate defaults to standard input. The following command line takes advantage of this to append all subsequently entered text (that is, standard input) to the Worksheet window. To terminate input, press Command-Enter.

Catenate >> {Worksheet}

SEE ALSO

Duplicate

 
 


Last Updated July 2000