xref: /titanic_51/usr/src/man/man1/paste.1 (revision 45e662eb8429b38c18931ebeed30f2e5287ae51b)
te
Copyright 1989 AT&T Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
http://www.opengroup.org/bookstore/.
The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
This notice shall appear on any product containing this material.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
PASTE 1 "Dec 20, 1996"
NAME
paste - merge corresponding or subsequent lines of files
SYNOPSIS

paste [-s] [-d list] file...
DESCRIPTION

The paste utility will concatenate the corresponding lines of the given input files, and write the resulting lines to standard output.

The default operation of paste will concatenate the corresponding lines of the input files. The NEWLINE character of every line except the line from the last input file will be replaced with a TAB character.

If an EOF (end-of-file) condition is detected on one or more input files, but not all input files, paste will behave as though empty lines were read from the files on which EOF was detected, unless the -s option is specified.

OPTIONS

The following options are supported: -d list

Unless a backslash character (\|\e\|) appears in list, each character in list is an element specifying a delimiter character. If a backslash character appears in list, the backslash character and one or more characters following it are an element specifying a delimiter character as described below. These elements specify one or more delimiters to use, instead of the default TAB character, to replace the NEWLINE character of the input lines. The elements in list are used circularly. That is, when the list is exhausted, the first element from the list is reused. When the -s option is specified:

The last newline character in a file will not be modified.

The delimiter will be reset to the first element of list after each file operand is processed.

When the option is not specified:

The NEWLINE characters in the file specified by the last file will not be modified.

The delimiter will be reset to the first element of list each time a line is processed from each file.

If a backslash character appears in list, it and the character following it will be used to represent the following delimiter characters: \en

Newline character.

\et

Tab character.

\e\e

Backslash character.

\e0

Empty string (not a null character). If \e0 is immediately followed by the character x, the character X, or any character defined by the LC_CTYPE digit keyword, the results are unspecified.

If any other characters follow the backslash, the results are unspecified.
-s

Concatenate all of the lines of each separate input file in command line order. The NEWLINE character of every line except the last line in each input file will be replaced with the TAB character, unless otherwise specified by the -d option.

OPERANDS

The following operand is supported: file

A path name of an input file. If - is specified for one or more of the files, the standard input will be used. The standard input will be read one line at a time, circularly, for each instance of -. Implementations support pasting of at least 12 file operands.

USAGE

See largefile(5) for the description of the behavior of paste when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).

EXAMPLES

Example 1 Listing a directory in one column

example% ls | paste -d" " -

Example 2 Listing a directory in four columns

example% ls | paste - - - -

Example 3 Combining pairs of lines from a file into single lines

example% paste -s -d"\e t\e n" file
ENVIRONMENT VARIABLES

See environ(5) for descriptions of the following environment variables that affect the execution of paste: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.

EXIT STATUS

The following exit values are returned: 0

Successful completion.

>0

An error occurred.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
CSI Enabled
Interface Stability Standard
SEE ALSO

cut(1), grep(1), pr(1), attributes(5), environ(5), largefile(5), standards(5)

DIAGNOSTICS
"line too long"

Output lines are restricted to 511 characters.

"too many files"

Except for -s option, no more than 12 input files may be specified.

"no delimiters"

The -d option was specified with an empty list.

"cannot open file"

The specified file cannot be opened.