paste

horizontally concatenate lines 

Command


SYNOPSIS

paste [-s] [-d list] file ...


DESCRIPTION

paste concatenates lines of all the specified input files onto the standard output. If you specify - instead of a file, paste uses the standard input. Normally, 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

-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. 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 may 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 an end-of-file is detected on any (but not all) of the input files, paste behaves as though empty lines have been read from those files.


EXAMPLES

The command ls | paste -s -d'\t\t\n' displays the output of ls in three tab separated columns.

If file A contains:

a
b
c

and file X contains:

x
y
z

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

DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following:

— missing input files
— too many files specified
— inability to open a file
2 

Unknown command line option.

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 4.0. UNIX System V. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
cut


PTC MKS Toolkit 10.4 Documentation Build 39.