]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - usr.bin/paste/paste.1
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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 .\" 4. 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 .\"     @(#)paste.1     8.1 (Berkeley) 6/6/93
33 .\" $FreeBSD$
34 .\"
35 .Dd June 25, 2004
36 .Dt PASTE 1
37 .Os
38 .Sh NAME
39 .Nm paste
40 .Nd merge corresponding or subsequent lines of files
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl s
44 .Op Fl d Ar list
45 .Ar
46 .Sh DESCRIPTION
47 The
48 .Nm
49 utility concatenates the corresponding lines of the given input files,
50 replacing all but the last file's newline characters with a single tab
51 character, and writes the resulting lines to standard output.
52 If end-of-file is reached on an input file while other input files
53 still contain data, the file is treated as if it were an endless source
54 of empty lines.
55 .Pp
56 The options are as follows:
57 .Bl -tag -width Fl
58 .It Fl d Ar list
59 Use one or more of the provided characters to replace the newline
60 characters instead of the default tab.
61 The characters in
62 .Ar list
63 are used circularly, i.e., when
64 .Ar list
65 is exhausted the first character from
66 .Ar list
67 is reused.
68 This continues until a line from the last input file (in default operation)
69 or the last line in each file (using the
70 .Fl s
71 option) is displayed, at which
72 time
73 .Nm
74 begins selecting characters from the beginning of
75 .Ar list
76 again.
77 .Pp
78 The following special characters can also be used in list:
79 .Pp
80 .Bl -tag -width flag -compact
81 .It Li \en
82 newline character
83 .It Li \et
84 tab character
85 .It Li \e\e
86 backslash character
87 .It Li \e0
88 Empty string (not a null character).
89 .El
90 .Pp
91 Any other character preceded by a backslash is equivalent to the
92 character itself.
93 .It Fl s
94 Concatenate all of the lines of each separate input file in command line
95 order.
96 The newline character of every line except the last line in each input
97 file is replaced with the tab character, unless otherwise specified by
98 the
99 .Fl d
100 option.
101 .El
102 .Pp
103 If
104 .Sq Fl
105 is specified for one or more of the input files, the standard
106 input is used; standard input is read one line at a time, circularly,
107 for each instance of
108 .Sq Fl .
109 .Sh EXIT STATUS
110 .Ex -std
111 .Sh EXAMPLES
112 List the files in the current directory in three columns:
113 .Pp
114 .Dl "ls | paste - - -"
115 .Pp
116 Combine pairs of lines from a file into single lines:
117 .Pp
118 .Dl "paste -s -d '\et\en' myfile"
119 .Pp
120 Number the lines in a file, similar to
121 .Xr nl 1 :
122 .Pp
123 .Dl "sed = myfile | paste -s -d '\et\en' - -"
124 .Pp
125 Create a colon-separated list of directories named
126 .Pa bin ,
127 suitable
128 for use in the
129 .Ev PATH
130 environment variable:
131 .Pp
132 .Dl "find / -name bin -type d | paste -s -d : -"
133 .Sh SEE ALSO
134 .Xr cut 1 ,
135 .Xr lam 1
136 .Sh STANDARDS
137 The
138 .Nm
139 utility is expected to be
140 .St -p1003.2
141 compatible.
142 .Sh HISTORY
143 A
144 .Nm
145 command appeared in
146 .At 32v .