]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/paste/paste.1
use long manpage URL (broken in last commit)
[FreeBSD/FreeBSD.git] / usr.bin / paste / paste.1
1 .\" Copyright (c) 1989, 1990, 1993
2 .\"     The Regents of the University of California.  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 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .Dd November 6, 2022
33 .Dt PASTE 1
34 .Os
35 .Sh NAME
36 .Nm paste
37 .Nd merge corresponding or subsequent lines of files
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl s
41 .Op Fl d Ar list
42 .Ar
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility concatenates the corresponding lines of the given input files,
47 replacing all but the last file's newline characters with a single tab
48 character, and writes the resulting lines to standard output.
49 If end-of-file is reached on an input file while other input files
50 still contain data, the file is treated as if it were an endless source
51 of empty lines.
52 .Pp
53 The options are as follows:
54 .Bl -tag -width Fl
55 .It Fl d Ar list
56 Use one or more of the provided characters to replace the newline
57 characters instead of the default tab.
58 The characters in
59 .Ar list
60 are used circularly, i.e., when
61 .Ar list
62 is exhausted the first character from
63 .Ar list
64 is reused.
65 This continues until a line from the last input file (in default operation)
66 or the last line in each file (using the
67 .Fl s
68 option) is displayed, at which
69 time
70 .Nm
71 begins selecting characters from the beginning of
72 .Ar list
73 again.
74 .Pp
75 The following special characters can also be used in list:
76 .Pp
77 .Bl -tag -width flag -compact
78 .It Li \en
79 newline character
80 .It Li \et
81 tab character
82 .It Li \e\e
83 backslash character
84 .It Li \e0
85 Empty string (not a null character).
86 .El
87 .Pp
88 Any other character preceded by a backslash is equivalent to the
89 character itself.
90 .It Fl s
91 Concatenate all of the lines of each separate input file in command line
92 order.
93 The newline character of every line except the last line in each input
94 file is replaced with the tab character, unless otherwise specified by
95 the
96 .Fl d
97 option.
98 .El
99 .Pp
100 If
101 .Sq Fl
102 is specified for one or more of the input files, the standard
103 input is used; standard input is read one line at a time, circularly,
104 for each instance of
105 .Sq Fl .
106 .Sh EXIT STATUS
107 .Ex -std
108 .Sh EXAMPLES
109 List the files in the current directory in three columns:
110 .Pp
111 .Dl "ls | paste - - -"
112 .Pp
113 Combine pairs of lines from a file into single lines:
114 .Pp
115 .Dl "paste -s -d '\et\en' myfile"
116 .Pp
117 Number the lines in a file, similar to
118 .Xr nl 1 :
119 .Pp
120 .Dl "sed = myfile | paste - -"
121 .Pp
122 Create a colon-separated list of directories named
123 .Pa bin ,
124 suitable
125 for use in the
126 .Ev PATH
127 environment variable:
128 .Pp
129 .Dl "find / -name bin -type d | paste -s -d : -"
130 .Sh SEE ALSO
131 .Xr cut 1 ,
132 .Xr lam 1
133 .Sh STANDARDS
134 The
135 .Nm
136 utility is expected to be
137 .St -p1003.2
138 compatible.
139 .Sh HISTORY
140 A
141 .Nm
142 command first appeared in
143 .At III
144 and has been available since
145 .Bx 4.3 Reno .
146 .Sh AUTHORS
147 .An -nosplit
148 The original Bell Labs version was written by
149 .An Gottfried W. R. Luderer
150 and the
151 .Bx
152 version by
153 .An Adam S. Moskowitz
154 and
155 .An Marciano Pitargue .