xref: /original-bsd/usr.bin/paste/paste.1 (revision f955cb91)
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 and the Institute of Electrical and Electronics
6.\" Engineers, Inc.
7.\"
8.\" %sccs.include.redist.roff%
9.\"
10.\"	@(#)paste.1	5.6 (Berkeley) 07/27/91
11.\"
12.Dd
13.Dt PASTE 1
14.Os
15.Sh NAME
16.Nm paste
17.Nd merge corresponding or subsequent lines of files
18.Sh SYNOPSIS
19.Nm paste
20.Op Fl s
21.Op Fl d Ar list
22.Ar file ...
23.Sh DESCRIPTION
24The
25.Nm paste
26utility concatenates the corresponding lines of the given input files,
27replacing all but the last file's newline characters with a single tab
28character, and writes the resulting lines to standard output.
29If end-of-file is reached on an input file while other input files
30still contain data, the file is treated as if it were an endless source
31of empty lines.
32.Pp
33The options are as follows:
34.Bl -tag -width Fl
35.It Fl d  Ar list
36Use one or more of the provided characters to replace the newline
37characters instead of the default tab.
38The characters in
39.Ar list
40are used circularly, i.e., when
41.Ar list
42is exhausted the first character from
43.Ar list
44is reused.
45This continues until a line from the last input file (in default operation)
46or the last line in each file (using the -s option) is displayed, at which
47time
48.Nm paste
49begins selecting characters from the beginning of
50.Ar list
51again.
52.Pp
53The following special characters can also be used in list:
54.Pp
55.Bl -tag -width flag -compact
56.It Li \en
57newline character
58.It Li \et
59tab character
60.It Li \e\e
61backslash character
62.It Li \e0
63Empty string (not a null character).
64.El
65.Pp
66Any other character preceded by a backslash is equivalent to the
67character itself.
68.It Fl s
69Concatenate all of the lines of each separate input file in command line
70order.
71The newline character of every line except the last line in each input
72file is replaced with the tab character, unless otherwise specified by
73the -d option.
74.El
75.Pp
76If
77.Ql Fl
78is specified for one or more of the input files, the standard
79input is used; standard input is read one line at a time, circularly,
80for each instance of
81.Ql Fl .
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
91utility is expected to be
92.St -p1003.2
93compatible.
94