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