Format
paste [–Bs]
[–d list] [-W option[,option]...] file
…
Description
paste concatenates
lines of all the specified input files onto the standard output. If
you specify – (dash) instead of a file, paste uses
the standard input. Typically, an output
line consists of the corresponding lines from all the input files. paste replaces
the newline character at the end of each input line (except the one
from the last file on the command line) with a tab character, or characters
specified by the –d option.
Options
- –B
- Disables the automatic conversion of tagged files. This option
is ignored if the filecodeset or pgmcodeset options
(-W option) are specified.
- –d list
- Specifies a list of characters to be used one at a time instead
of the tab character to replace the newline at the end of input lines.
In a double-byte locale, list can contain
double-byte characters. paste uses list circularly;
when it exhausts the characters in list,
it returns to the first character in the list. If you also specify
the –s option, paste returns
to the first character of list after processing
each file. Otherwise, it returns to the first character after each
line of output.
list can contain any
of the following standard C escapes such as \n, \t, \r, \b, \\,
and \0, where \0 indicates that
no separator is to be used.
- –s
- Concatenates all lines from each input file together on the single
output line. If the –s option is not specified
and the end of the file is detected on any (but not all) of the input
files, paste behaves as though empty lines
have been read from those files.
- -W option[,option]...
- Specifies z/OS-specific options. The option keywords are case-sensitive. Possible
options are:
- filecodeset=codeset
- Performs text conversion from one code set to another when reading
from the file. The coded character set of the file is codeset. codeset can
be a code set name known to the system or a numeric coded character
set identifier (CCSID). Note that the command iconv -l lists
existing CCSIDs along with their corresponding code set names. The filecodeset and pgmcodeset options
can be used on files with any file tag.
If pgmcodeset is
specified but filecodeset is omitted, then
the default file code set is ISO8859-1 even if the file is tagged
with a different code set. If neither filecodeset nor pgmcodeset is
specified, text conversion will not occur unless automatic conversion
is enabled or the _TEXT_CONV environment variable indicates text conversion.
For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.
If filecodeset or pgmcodeset is
specified, then automatic conversion is disabled for this command
invocation and the -B option is ignored
if it is also specified. See z/OS UNIX System Services Planning for
more information about automatic conversion.
When specifying values for filecodeset,
use the values that Unicode Service supports. For more information
about supported code sets, see z/OS Unicode Services User's Guide and Reference.
- pgmcodeset=codeset
- Performs text conversion from one code set to another when reading
from the file. The coded character set of the program (command) is codeset. codeset can
be a code set name known to the system or a numeric coded character
set identifier (CCSID). Note that the command iconv -l lists
existing CCSIDs along with their corresponding code set names. The filecodeset and pgmcodeset options
can be used on files with any file tag.
If filecodeset is
specified but pgmcodeset is omitted, then
the default program code set is IBM-1047. If neither filecodeset nor pgmcodeset is
specified, text conversion will not occur unless automatic conversion
is enabled or the _TEXT_CONV environment variable indicates text conversion.
For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.
If filecodeset or pgmcodeset is
specified, then automatic conversion is disabled for this command
invocation and the -B option is ignored
if it is also specified. See z/OS UNIX System Services Planning for
more information about automatic conversion.
Restriction: The
only supported values for pgmcodeset are
IBM-1047 and 1047.
Examples
- To display the ls output
in three tab-separated columns:
ls | paste - - -
- To concatenate lines in two text files containing UTF-8 characters, assuming that
- The text files are untagged and you do not want to tag them or
enable automatic conversion, and
- You cannot alter the tag (for example, you are displaying untagged
public text files or read-only text files)
then issue: paste -W filecodeset=UTF-8,pgmcodeset=IBM-1047 myUtf8File01 myUtf8File02
- To concatenate lines in three text files containing
EBCDIC characters, assuming that automatic conversion has been enabled
but the text files are incorrectly tagged as ASCII:
paste -B myMisTaggedFile01 myMisTaggedFile02 myMisTaggedFile03
- If file A contains:
a
b
c
and file X contains x
y
z
then the command: paste A X
produces:
a x
b y
c z
and the command: paste –s A X
produces:
a b c
x y z
Localization
paste uses
the following localization environment variables:
- LANG
- LC_ALL
- LC_CTYPE
- LC_MESSAGES
- LC_SYNTAX
- NLSPATH
See Localization for more
information.
Environment variables
paste uses
the following environment variable:
- _TEXT_CONV
- Contains text conversion information for the command. The text
conversion information is not used when either the -B option
or the filecodeset or pgmcodeset option
(-W option) is specified. For more information
about text conversion, see Controlling text conversion for z/OS UNIX shell commands.
Exit values
- 0
- Successful completion
- 1
- Failure due to any of the following:
- Too many files specified
- Inability to open a file
- The code set is not valid
- Could not turn off automatic conversion
- Could not perform requested text conversion
- 2
- Failure due to any of the following:
- Incorrect command-line option
- Missing input files
Messages
Possible error messages include:
- Too many files at name
- You specified more files than paste can
handle. The name given in the error message is the name of the first
file that paste could not open. The number
of files that paste can open depends on
the number of files that other processes have open.
Portability
POSIX.2, X/Open Portability Guide, UNIX System V.
The –B and -W options
are extensions of the POSIX standard.