home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
329_01
/
paste.doc
< prev
next >
Wrap
Text File
|
1988-12-13
|
6KB
|
199 lines
PASTE(1) UNIX 4.0 PASTE(1)
NAME
paste - merge same lines of several files or subsequent
lines of one file
SYNOPSIS
paste file1 file2 ...
paste -dlist file1 file2 ...
paste -s [-d]list file1 file2 ...
DESCRIPTION
In the first two forms, paste concatenates corresponding
lines of the given input files file1, file2, etc. 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 cat(1) which concatenates vertically,
i.e., one file after the other. In the last form above,
paste replaces the function of an older command with the
same name by combining subsequent lines of the input file
(serial merging). In all cases, lines are glued together
with the tab character, or with characters from an
optionally specified list. Output is to the standard
output, so it can be used as the start of a pipe, or as a
filter, if - is used in place of a file name.
The meanings of the options are:
-d
Without this option, the new-line characters of each but
the last file (or last line in case of the -s option) are
replaced by a tab character. This option allows replacing
the tab character by one or more alternate characters (see
below).
list
One or more characters immediately following -d replace the
default tab as the line concatenation character. The list
is used circularly, i.e., when exhausted, it is reused. In
parallel merging (i.e., no -s option) the lines from the
last file are always terminated with a new-line character,
not from the list. The list may contain the special escape
sequences: \n (new-line), \t (tab), \\ (backslash), and \0
(empty string, not a null character.) Quoting may be
necessary, if characters have special meaning to the shell
(e.g., to get one backslash, use -_d"\\\\"). SPECIAL NOTE:
This version of paste has had the list of special
characters expanded from the Unix(Tm) standard to include
the following additional characters: \b (backspace), \f
(form-feed), \r (carriage return), \v (vertical tab).
-s
Merge subsequent lines rather than one from each input
file. Use tab for concatenation, unless a list is
Page 1 (printed 8/19/84)
PASTE(1) UNIX 4.0 PASTE(1)
specified with -d option. Regardless of the list, the very
last character of the file is forced to be a new-line.
-
May be used in place of any file name, to read a line from
the standard input. (There is no prompting).
EXAMPLES
ls | paste -d
list directory in one column
ls | paste - - - -
list directory in four columns
SEE ALSO
grep(1),paste(1).
DIAGNOSTICS
no delimiters
Missing list for -d option
<filename> : cannot open
paste was given a bad filename
too many files
Except for -s option, no more than 12 input files may be
specified.
CAVEATS
This program is a complete rewrite of the Bell Laboratories
command of the same name; no part of the original source or
manual is included. Therefore, you may feel free to use it,
and its source, without violation of any contract
agreements. However, I retain the copyright in order to
specify it remain available for use by all and sundry,
without cost. Feel free to modify as necessary, although I
went to great pains to recreate the behavior of the original
command; I would suggest this congruence be maintained.
Along the same lines, although I've made a reasonable effort
to test the more arcane behavior of the original paste and
reproduce it, there are no guarantees; and there are four
known differences between the original program and
documentation, and this version. All are downward
compatible. First, paste as distributed with Unix has a bug
in the way it handles multiple files for the -s option.
This has been fixed, and the bug reported to the providers
of the Unix command. Secondly, the list of valid escape
characters for the list has been expanded. Third, the 511
character/line restriction has been removed. Finally,
extant undocumented diagnostics have been added to the man
page, and the one pertaining to the (now obsolete) line too
Page 2 (printed 8/19/84)
PASTE(1) UNIX 4.0 PASTE(1)
long removed.
I remain in no way liable for any loss, either explicit or
incidental, that may be incurred through use of this
command. I do ask that any bugs (and, hopefully, fixes) be
reported back to me as encountered. - David M. Ihnat,
ihuxx!ignatz
Page 3 (printed 8/19/84)