Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)
paste(1) OSS Shell and Utilities Reference Manual
NAME
paste - Joins lines from one or more files
SYNOPSIS
paste [-d list][-s] file ...
The paste command reads input files, joins corresponding lines, and writes the result to stan-
dard output. It also reads standard input if you specify a - (dash) instead of a filename.
FLAGS
-d list Replaces the delimiter that separates lines in the output (tab by default) with one or
more characters from list.Iflist contains more than one character, then the characters
are repeated in order until the end of the output. In parallel merging, the lines from the
last file always end with a newline character instead of one from list.
The following special characters can be used in list:
\n Newline character
\t Tab
\\ Backslash
\0 Empty string (not a null character)
c An extended character
You must quote characters that have special meaning to the shell.
When the -s flag is specified with -d, the last newline character in a file is preserved,
and the delimiter is reset to the first element of list after each file is processed. If -s is
not specified with -d, the newline characters in the last file specified are preserved, and
the delimiter is reset to the first element of list each time a line is processed.
-s Merges all lines from each input file into one line of output (serial merging). With this
flag, paste works through one entire file before starting on the next. When it finishes
merging the lines in one file, it forces a newline and then merges the lines in the next
input file, continuing in the same way through the remaining input files, one at a time.
A tab separates the input lines unless you use the -d flag. Regardless of the list, the last
character of the output is a newline character.
DESCRIPTION
Without a flag, or with the -d flag, paste treats each file as a column and joins them horizontally
with a tab character by default (parallel merging).
With the -s flag, paste combines all lines of each input file into one output line (serial merging).
These lines are joined with the tab character by default.
Output lines can be of arbitrary length.
If an End-of-File condition is detected on one or more input files, but not all input files, paste
behaves as though empty lines were read from the file(s) on which End-of-File was detected,
unless the -s flag is specified.
Note that the output of pr -t -m is similar to that of paste, but it creates extra spaces, tabs, and
lines for an enhanced page layout.
7−4 Hewlett-Packard Company 527188-007