xref: /netbsd-src/usr.bin/paste/paste.1 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: paste.1,v 1.7 2003/08/07 11:15:28 agc 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. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	from: @(#)paste.1	8.1 (Berkeley) 6/6/93
35.\"	$NetBSD: paste.1,v 1.7 2003/08/07 11:15:28 agc Exp $
36.\"
37.Dd June 6, 1993
38.Dt PASTE 1
39.Os
40.Sh NAME
41.Nm paste
42.Nd merge corresponding or subsequent lines of files
43.Sh SYNOPSIS
44.Nm
45.Op Fl s
46.Op Fl d Ar list
47.Ar file ...
48.Sh DESCRIPTION
49The
50.Nm
51utility concatenates the corresponding lines of the given input files,
52replacing all but the last file's newline characters with a single tab
53character, and writes the resulting lines to standard output.
54If end-of-file is reached on an input file while other input files
55still contain data, the file is treated as if it were an endless source
56of empty lines.
57.Pp
58The options are as follows:
59.Bl -tag -width Fl
60.It Fl d  Ar list
61Use one or more of the provided characters to replace the newline
62characters instead of the default tab.
63The characters in
64.Ar list
65are used circularly, i.e., when
66.Ar list
67is exhausted the first character from
68.Ar list
69is reused.
70This continues until a line from the last input file (in default operation)
71or the last line in each file (using the -s option) is displayed, at which
72time
73.Nm
74begins selecting characters from the beginning of
75.Ar list
76again.
77.Pp
78The following special characters can also be used in list:
79.Pp
80.Bl -tag -width flag -compact
81.It Li \en
82newline character
83.It Li \et
84tab character
85.It Li \e\e
86backslash character
87.It Li \e0
88Empty string (not a null character).
89.El
90.Pp
91Any other character preceded by a backslash is equivalent to the
92character itself.
93.It Fl s
94Concatenate all of the lines of each separate input file in command line
95order.
96The newline character of every line except the last line in each input
97file is replaced with the tab character, unless otherwise specified by
98the -d option.
99.El
100.Pp
101If
102.Ql Fl
103is specified for one or more of the input files, the standard
104input is used; standard input is read one line at a time, circularly,
105for each instance of
106.Ql Fl .
107.Pp
108The
109.Nm
110utility exits 0 on success, and \*[Gt]0 if an error occurs.
111.Sh SEE ALSO
112.Xr cut 1
113.Sh STANDARDS
114The
115.Nm
116utility is expected to be
117.St -p1003.2
118compatible.
119