153 lines
4.3 KiB
Groff
153 lines
4.3 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g1.paste @(#)paste 41.9 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} paste 1 "Directory and File Management Utilities" "\&"
|
|
.if \nX=1 .ds x} paste 1 "Directory and File Management Utilities"
|
|
.if \nX=2 .ds x} paste 1 "" "\&"
|
|
.if \nX=3 .ds x} paste "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4paste\f1 \- merge same lines of several files or subsequent lines of one file
|
|
.SH SYNOPSIS
|
|
\f4paste\f1 \f4\-\fP|\f2file1\fP \f4\-\fP|\f2file2\fP . . .
|
|
.br
|
|
\f4paste \-d\f1\|\f2list \f4\-\fP|\f2file1\fP \f4\-\fP|\f2file2\fP . . .
|
|
.br
|
|
\f4paste \-s [\-d\f1\|\f2list\f1\|] \f4\-\fP|\f2file1\fP . . .
|
|
.SH DESCRIPTION
|
|
In the first two forms,
|
|
\f4paste\fP
|
|
concatenates corresponding lines of the given input
|
|
files
|
|
.IR file1 ,
|
|
.IR file2 ,
|
|
and so on.
|
|
It treats each file as a column or columns
|
|
of a table and pastes them together horizontally
|
|
(parallel merging).
|
|
If you will, it is
|
|
the counterpart of
|
|
\f4cat\fP(1)
|
|
which concatenates vertically, that is,
|
|
one file after the other.
|
|
In the last form above,
|
|
\f4paste\fP
|
|
replaces the function of an older command with the same name
|
|
by combining subsequent lines of the input file (serial merging).
|
|
If more than one file is specified with the \f4\-s\fP option, \f4paste\fP(1)
|
|
concatenates the merged files one below the other.
|
|
In all cases,
|
|
lines are glued together with the
|
|
.I tab\^
|
|
character,
|
|
or with characters from an optionally specified
|
|
.IR list .
|
|
Output is to the standard output, so it can be used as
|
|
the start of a pipe,
|
|
or as a filter,
|
|
if \f4\-\fP is used in place of a file name.
|
|
\f4paste\f1 processes supplementary code set characters
|
|
in \f2files\f1, and recognizes supplementary code set
|
|
characters in the \f2list\f1 given to the \f4\-d\f1 option (see below)
|
|
according to the locale specified in the \f4LC_CTYPE\fP
|
|
environment variable [see \f4LANG\fP on \f4environ\fP(5)].
|
|
.PP
|
|
The meanings of the options are:
|
|
.TP
|
|
\f4\-d\f1
|
|
Without this option,
|
|
the new-line characters of each but the last file
|
|
(or last line in case of the
|
|
\f4\-s\f1
|
|
option)
|
|
are replaced
|
|
by a
|
|
.I tab\^
|
|
character.
|
|
This option allows replacing the
|
|
.I tab\^
|
|
character by one or more alternate characters (see below).
|
|
.TP
|
|
.I "list\^"
|
|
One or more characters immediately following
|
|
\f4\-d\f1
|
|
replace the default
|
|
.I tab\^
|
|
as the line concatenation character.
|
|
The list is used sequentially and circularly: first, the first element on the
|
|
list is used to concatenate the lines, then the next, and so on; when all
|
|
elements have been used, the list is reused starting from the first element.
|
|
In parallel merging (that is, no \f4\-s\f1 option),
|
|
the lines from the last file are always terminated with a new-line character,
|
|
not from the
|
|
.IR list .
|
|
The list may contain the special escape sequences:
|
|
\f4\en\f1
|
|
(new-line),
|
|
\f4\et\f1
|
|
(tab),
|
|
\f4\e\e\f1
|
|
(backslash), and
|
|
\f4\e0\f1
|
|
(empty string, not a null character).
|
|
Quoting may be necessary, if characters have special meaning to the shell
|
|
(for example, to get one backslash, use
|
|
.I \-d\|"\e\e\e\e\^"
|
|
).
|
|
\f2list\f1 may contain supplementary code set characters.
|
|
.TP
|
|
\f4\-s\f1
|
|
Merge subsequent lines rather than one from each input file.
|
|
Use
|
|
.I tab\^
|
|
for concatenation, unless a
|
|
.I list\^
|
|
is specified
|
|
with
|
|
\f4\-d\f1
|
|
option.
|
|
Regardless of the
|
|
.IR list ,
|
|
the very last character of the file is forced to be a new-line.
|
|
.TP
|
|
\f4\-\f1
|
|
May be used in place of any file name,
|
|
to read a line from the standard input.
|
|
(There is no prompting).
|
|
.br
|
|
.ne 2i
|
|
.SH EXAMPLES
|
|
.TP 15m
|
|
\f4ls \|\(bv\| paste \|\-d" " \|\-\f1
|
|
Lists directory in one column
|
|
.TP
|
|
\f4ls \|\(bv\| paste \|\- \|\- \|\- \|\-\f1
|
|
Lists directory in four columns
|
|
.TP
|
|
\f4paste \|\-d"\e\|t\e\|n"\fP \f2file1 file2\fP
|
|
Lists \f2file1\fP in column 1 and \f2file2\fP in column 2.
|
|
The columns are separated by a tab.
|
|
.TP
|
|
\f4paste \-s \-d"\e\|t\e\|n"\fP \f2file1 file2\fP
|
|
Merges pairs of subsequent lines first in \f2file1\fP, then in \f2file2\fP.
|
|
Concatenates the merged \f2file2\fP below \f2file1\fP.
|
|
.SH FILES
|
|
.TP
|
|
\f4/usr/lib/locale/\f2locale\f4/LC_MESSAGES/uxdfm\f1
|
|
language-specific message file [See \f4LANG\fP on \f4environ\f1(5).]
|
|
.SH "SEE ALSO"
|
|
\f4cut\fP(1), \f4grep\fP(1), \f4pr\fP(1)
|
|
.SH DIAGNOSTICS
|
|
.TP
|
|
\f4UX:paste:ERROR:line too long\f1
|
|
Output lines are restricted to 4096 bytes.
|
|
.TP
|
|
\f4UX:paste:ERROR:too many files\f1
|
|
Except for
|
|
\f4\-s\f1
|
|
option, no more than 12 input files may be specified.
|
|
.\" @(#)paste.1 6.2 of 9/2/83
|
|
.Ee
|