xref: /original-bsd/usr.bin/paste/paste.1 (revision c829ecf6)
1.\" Copyright (c) 1989, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Adam S. Moskowitz of Menlo Consulting.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\"     @(#)paste.1	5.2 (Berkeley) 06/11/90
10.\"
11.Dd
12.Dt PASTE 1
13.Os BSD 4.4
14.Sh NAME
15.Nm paste
16.Nd merge corresponding or subsequent lines of files
17.Sh SYNOPSIS
18.Nm paste
19.Op Fl s
20.Op Fl d Ar list
21.Ar file ...
22.Sh DESCRIPTION
23The
24.Nm paste
25utility concatenates the corresponding lines of the given input files,
26replacing all but the last file's newline characters with a single tab
27character, and writes the resulting lines to standard output.
28If end-of-file is reached on an input file while other input files
29still contain data, the file is treated as if it were an endless source
30of empty lines.
31.Pp
32The options are as follows:
33.Tw Fl
34.Tp Cx Fl d
35.Ar list
36.Cx
37Use one or more of the provided characters to replace the newline
38characters instead of the default tab.
39The characters in
40.Ar list
41are used circularly, i.e., when
42.Ar list
43is exhausted the first character from
44.Ar list
45is reused.
46This continues until a line from the last input file (in default operation)
47or the last line in each file (using the -s option) is displayed, at which
48time
49.Nm paste
50begins selecting characters from the beginning of
51.Ar list
52again.
53.Pp
54The following special characters can also be used in list:
55.Tw Ds
56.Tp Li \en
57newline character
58.br
59.Tp Li \et
60tab character
61.br
62.Tp Li \e\e
63backslash character
64.br
65.Tp Li \e0
66Empty string (not a null character).
67.Pp
68Any other character preceded by a backslash is equivalent to the
69character itself.
70.Tp
71.Tp Fl s
72Concatenate all of the lines of each separate input file in command line
73order.
74The newline character of every line except the last line in each input
75file is replaced with the tab character, unless otherwise specified by
76the -d option.
77.Tp
78.Pp
79If ``-'' is specified for one or more of the input files, the standard
80input is used; standard input is read one line at a time, circularly,
81for each instance of ``-''.
82.Pp
83The
84.Nm paste
85utility exits 0 on success, and >0 if an error occurs.
86.Sh SEE ALSO
87.Xr cut 1
88.Sh STANDARDS
89The
90.Nm paste
91function is expected to be POSIX 1003.2 compatible.
92