checkpoint of hacking for mail.cs.berkeley.edu
[unix-history] / usr / src / usr.bin / paste / paste.1
CommitLineData
b5dc1377 1.\" Copyright (c) 1989, 1990 The Regents of the University of California.
6ac1351a 2.\" All rights reserved.
b5dc1377 3.\"
6ac1351a 4.\" This code is derived from software contributed to Berkeley by
ae122740
KB
5.\" Adam S. Moskowitz and the Institute of Electrical and Electronics
6.\" Engineers, Inc.
6ac1351a 7.\"
ae122740 8.\" %sccs.include.redist.roff%
6ac1351a 9.\"
263cc8fc 10.\" @(#)paste.1 5.6 (Berkeley) %G%
6ac1351a 11.\"
b5dc1377
CL
12.Dd
13.Dt PASTE 1
ee9b0a0a 14.Os
b5dc1377
CL
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
6ac1351a 24The
b5dc1377 25.Nm paste
6ac1351a
KB
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.
b5dc1377 32.Pp
6ac1351a 33The options are as follows:
263cc8fc
CL
34.Bl -tag -width Fl
35.It Fl d Ar list
6ac1351a
KB
36Use one or more of the provided characters to replace the newline
37characters instead of the default tab.
38The characters in
b5dc1377 39.Ar list
6ac1351a 40are used circularly, i.e., when
b5dc1377 41.Ar list
6ac1351a 42is exhausted the first character from
b5dc1377 43.Ar list
6ac1351a
KB
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
b5dc1377 48.Nm paste
6ac1351a 49begins selecting characters from the beginning of
b5dc1377 50.Ar list
6ac1351a 51again.
b5dc1377 52.Pp
6ac1351a 53The following special characters can also be used in list:
263cc8fc
CL
54.Pp
55.Bl -tag -width flag -compact
56.It Li \en
6ac1351a 57newline character
263cc8fc 58.It Li \et
6ac1351a 59tab character
263cc8fc 60.It Li \e\e
6ac1351a 61backslash character
263cc8fc 62.It Li \e0
6ac1351a 63Empty string (not a null character).
263cc8fc 64.El
b5dc1377 65.Pp
6ac1351a
KB
66Any other character preceded by a backslash is equivalent to the
67character itself.
263cc8fc 68.It Fl s
6ac1351a
KB
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.
263cc8fc 74.El
b5dc1377 75.Pp
263cc8fc
CL
76If
77.Ql Fl
78is specified for one or more of the input files, the standard
6ac1351a 79input is used; standard input is read one line at a time, circularly,
263cc8fc
CL
80for each instance of
81.Ql Fl .
b5dc1377 82.Pp
6ac1351a 83The
b5dc1377 84.Nm paste
6ac1351a 85utility exits 0 on success, and >0 if an error occurs.
b5dc1377
CL
86.Sh SEE ALSO
87.Xr cut 1
88.Sh STANDARDS
6ac1351a 89The
b5dc1377 90.Nm paste
263cc8fc
CL
91utility is expected to be
92.St -p1003.2
93compatible.