xref: /openbsd-src/usr.bin/paste/paste.1 (revision 62a742911104f98b9185b2c6b6007d9b1c36396c)
1.\"	$OpenBSD: paste.1,v 1.3 1998/09/27 16:57:49 aaron Exp $
2.\" Copyright (c) 1989, 1990 The Regents of the University of California.
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" Adam S. Moskowitz and the Institute of Electrical and Electronics
7.\" Engineers, Inc.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"	This product includes software developed by the University of
20.\"	California, Berkeley and its contributors.
21.\" 4. Neither the name of the University nor the names of its contributors
22.\"    may be used to endorse or promote products derived from this software
23.\"    without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
36.\"
37.\"	from: @(#)paste.1	5.6 (Berkeley) 7/27/91
38.\"
39.Dd July 27, 1991
40.Dt PASTE 1
41.Os
42.Sh NAME
43.Nm paste
44.Nd merge corresponding or subsequent lines of files
45.Sh SYNOPSIS
46.Nm paste
47.Op Fl s
48.Op Fl d Ar list
49.Ar file Op Ar ...
50.Sh DESCRIPTION
51The
52.Nm paste
53utility concatenates the corresponding lines of the given input files,
54replacing all but the last file's newline characters with a single tab
55character, and writes the resulting lines to standard output.
56If end-of-file is reached on an input file while other input files
57still contain data, the file is treated as if it were an endless source
58of empty lines.
59.Pp
60The options are as follows:
61.Bl -tag -width Fl
62.It Fl d  Ar list
63Use one or more of the provided characters to replace the newline
64characters instead of the default tab.
65The characters in
66.Ar list
67are used circularly, i.e., when
68.Ar list
69is exhausted the first character from
70.Ar list
71is reused.
72This continues until a line from the last input file (in default operation)
73or the last line in each file (using the
74.Fl s
75option) is displayed, at which
76time
77.Nm paste
78begins selecting characters from the beginning of
79.Ar list
80again.
81.Pp
82The following special characters can also be used in list:
83.Pp
84.Bl -tag -width flag -compact
85.It Li \en
86newline character
87.It Li \et
88tab character
89.It Li \e\e
90backslash character
91.It Li \e0
92empty string (not a null character)
93.El
94.Pp
95Any other character preceded by a backslash is equivalent to the
96character itself.
97.It Fl s
98Concatenate all of the lines of each separate input file in command line
99order.
100The newline character of every line except the last line in each input
101file is replaced with the tab character, unless otherwise specified by
102the
103.Fl d
104option.
105.El
106.Pp
107If
108.Ql Fl
109is specified for one or more of the input files, the standard
110input is used; standard input is read one line at a time, circularly,
111for each instance of
112.Ql Fl .
113.Pp
114The
115.Nm paste
116utility exits 0 on success or >0 if an error occurred.
117.Sh SEE ALSO
118.Xr cut 1
119.Sh STANDARDS
120The
121.Nm paste
122utility is expected to be
123.St -p1003.2
124compatible.
125