'\" 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] .TH PASTE 1 "Dec 20, 1996" .SH NAME paste \- merge corresponding or subsequent lines of files .SH SYNOPSIS .LP .nf \fBpaste\fR [\fB-s\fR] [\fB-d\fR \fIlist\fR] \fIfile\fR... .fi .SH DESCRIPTION .sp .LP The \fBpaste\fR utility will concatenate the corresponding lines of the given input files, and write the resulting lines to standard output. .sp .LP The default operation of \fBpaste\fR will concatenate the corresponding lines of the input files. The \fBNEWLINE\fR character of every line except the line from the last input file will be replaced with a \fBTAB\fR character. .sp .LP If an \fBEOF\fR (end-of-file) condition is detected on one or more input files, but not all input files, \fBpaste\fR will behave as though empty lines were read from the files on which \fBEOF\fR was detected, unless the \fB-s\fR option is specified. .SH OPTIONS .sp .LP The following options are supported: .sp .ne 2 .na \fB\fB-d\fR \fIlist\fR \fR .ad .RS 12n Unless a backslash character (\|\e\|) appears in \fIlist\fR, each character in \fIlist\fR is an element specifying a delimiter character. If a backslash character appears in \fIlist\fR, 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 \fBTAB\fR character, to replace the \fBNEWLINE\fR character of the input lines. The elements in \fIlist\fR are used circularly. That is, when the list is exhausted, the first element from the list is reused. .sp When the \fB-s\fR option is specified: .RS +4 .TP .ie t \(bu .el o The last newline character in a file will not be modified. .RE .RS +4 .TP .ie t \(bu .el o The delimiter will be reset to the first element of list after each \fIfile\fR operand is processed. .RE When the option is not specified: .RS +4 .TP .ie t \(bu .el o The \fBNEWLINE\fR characters in the file specified by the last \fIfile\fR will not be modified. .RE .RS +4 .TP .ie t \(bu .el o The delimiter will be reset to the first element of \fIlist\fR each time a line is processed from each file. .RE If a backslash character appears in \fIlist\fR, it and the character following it will be used to represent the following delimiter characters: .sp .ne 2 .na \fB\fB\en\fR \fR .ad .RS 9n Newline character. .RE .sp .ne 2 .na \fB\fB\et\fR \fR .ad .RS 9n Tab character. .RE .sp .ne 2 .na \fB\fB\e\e\fR \fR .ad .RS 9n Backslash character. .RE .sp .ne 2 .na \fB\fB\e0\fR \fR .ad .RS 9n Empty string (not a null character). If \fB\e0\fR is immediately followed by the character \fBx\fR, the character \fBX\fR, or any character defined by the \fBLC_CTYPE\fR \fBdigit\fR keyword, the results are unspecified. .RE If any other characters follow the backslash, the results are unspecified. .RE .sp .ne 2 .na \fB\fB-s\fR \fR .ad .RS 12n Concatenate all of the lines of each separate input file in command line order. The \fBNEWLINE\fR character of every line except the last line in each input file will be replaced with the \fBTAB\fR character, unless otherwise specified by the \fB-d\fR option. .RE .SH OPERANDS .sp .LP The following operand is supported: .sp .ne 2 .na \fB\fIfile\fR \fR .ad .RS 9n A path name of an input file. If \fB\(mi\fR is specified for one or more of the \fIfile\fRs, the standard input will be used. The standard input will be read one line at a time, circularly, for each instance of \fB\(mi\fR\&. Implementations support pasting of at least 12 \fIfile\fR operands. .RE .SH USAGE .sp .LP See \fBlargefile\fR(5) for the description of the behavior of \fBpaste\fR when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). .SH EXAMPLES .LP \fBExample 1 \fRListing a directory in one column .sp .in +2 .nf example% \fBls | paste -d" " \(mi\fR .fi .in -2 .sp .LP \fBExample 2 \fRListing a directory in four columns .sp .in +2 .nf example% \fBls | paste \(mi \(mi \(mi \(mi\fR .fi .in -2 .sp .LP \fBExample 3 \fRCombining pairs of lines from a file into single lines .sp .in +2 .nf example% \fBpaste -s -d"\e t\e n" file\fR .fi .in -2 .sp .SH ENVIRONMENT VARIABLES .sp .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBpaste\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .na \fB\fB0\fR \fR .ad .RS 7n Successful completion. .RE .sp .ne 2 .na \fB\fB>0\fR \fR .ad .RS 7n An error occurred. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ Interface Stability Standard .TE .SH SEE ALSO .sp .LP \fBcut\fR(1), \fBgrep\fR(1), \fBpr\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5) .SH DIAGNOSTICS .sp .ne 2 .na \fB\fB"line too long"\fR\fR .ad .RS 22n Output lines are restricted to 511 characters. .RE .sp .ne 2 .na \fB\fB"too many files"\fR\fR .ad .RS 22n Except for \fB-s\fR option, no more than 12 input files may be specified. .RE .sp .ne 2 .na \fB\fB"no delimiters"\fR\fR .ad .RS 22n The \fB-d\fR option was specified with an empty list. .RE .sp .ne 2 .na \fB\fB"cannot open \fR\fBfile\fR\fB"\fR\fR .ad .RS 22n The specified file cannot be opened. .RE