paste

Official Description

Joins corresponding lines of several files or subsequent lines in one file.

Syntax

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

Options

-d list establishes a delimiter list.

-s performs serial merging (one long line).

Oddities

Some implementations provide a -x option, enabling exportation.

Example

$ paste buzz buzz1           # Two files are in two columns
#! /bin/ksh     #! /bin/ksh
integer x=17    integer x=17
while : while :
do      do
x=17    x=x+1
done    if (( x>20 ))
        then
                 break
        fi
        done
        print $x
$
$ paste -s buzz              # Make a single line
#! /bin/ksh     integer x=17    while : do      x=17    done
$
				

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.