xref: /freebsd/usr.bin/paste/paste.1 (revision 06e482e60a60643b7d60549870f45c6ba6c4c7a8)
19b50d902SRodney W. Grimes.\" Copyright (c) 1989, 1990, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
59b50d902SRodney W. Grimes.\" Adam S. Moskowitz and the Institute of Electrical and Electronics
69b50d902SRodney W. Grimes.\" Engineers, Inc.
79b50d902SRodney W. Grimes.\"
89b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
99b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
109b50d902SRodney W. Grimes.\" are met:
119b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
129b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
139b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
149b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
159b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
169b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
179b50d902SRodney W. Grimes.\"    must display the following acknowledgement:
189b50d902SRodney W. Grimes.\"	This product includes software developed by the University of
199b50d902SRodney W. Grimes.\"	California, Berkeley and its contributors.
209b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
219b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
229b50d902SRodney W. Grimes.\"    without specific prior written permission.
239b50d902SRodney W. Grimes.\"
249b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
259b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
269b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
279b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
289b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
299b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
309b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
319b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
329b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
339b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
349b50d902SRodney W. Grimes.\" SUCH DAMAGE.
359b50d902SRodney W. Grimes.\"
369b50d902SRodney W. Grimes.\"	@(#)paste.1	8.1 (Berkeley) 6/6/93
37c3aac50fSPeter Wemm.\" $FreeBSD$
389b50d902SRodney W. Grimes.\"
39748dcfb0SGarrett Wollman.Dd September 20, 2001
409b50d902SRodney W. Grimes.Dt PASTE 1
419b50d902SRodney W. Grimes.Os
429b50d902SRodney W. Grimes.Sh NAME
439b50d902SRodney W. Grimes.Nm paste
449b50d902SRodney W. Grimes.Nd merge corresponding or subsequent lines of files
459b50d902SRodney W. Grimes.Sh SYNOPSIS
461e133604SPhilippe Charnier.Nm
479b50d902SRodney W. Grimes.Op Fl s
489b50d902SRodney W. Grimes.Op Fl d Ar list
4947dec781SRuslan Ermilov.Ar
509b50d902SRodney W. Grimes.Sh DESCRIPTION
519b50d902SRodney W. GrimesThe
521e133604SPhilippe Charnier.Nm
539b50d902SRodney W. Grimesutility concatenates the corresponding lines of the given input files,
549b50d902SRodney W. Grimesreplacing all but the last file's newline characters with a single tab
559b50d902SRodney W. Grimescharacter, and writes the resulting lines to standard output.
569b50d902SRodney W. GrimesIf end-of-file is reached on an input file while other input files
579b50d902SRodney W. Grimesstill contain data, the file is treated as if it were an endless source
589b50d902SRodney W. Grimesof empty lines.
599b50d902SRodney W. Grimes.Pp
609b50d902SRodney W. GrimesThe options are as follows:
619b50d902SRodney W. Grimes.Bl -tag -width Fl
629b50d902SRodney W. Grimes.It Fl d  Ar list
639b50d902SRodney W. GrimesUse one or more of the provided characters to replace the newline
649b50d902SRodney W. Grimescharacters instead of the default tab.
659b50d902SRodney W. GrimesThe characters in
669b50d902SRodney W. Grimes.Ar list
679b50d902SRodney W. Grimesare used circularly, i.e., when
689b50d902SRodney W. Grimes.Ar list
699b50d902SRodney W. Grimesis exhausted the first character from
709b50d902SRodney W. Grimes.Ar list
719b50d902SRodney W. Grimesis reused.
729b50d902SRodney W. GrimesThis continues until a line from the last input file (in default operation)
734ed31d66SPhilippe Charnieror the last line in each file (using the
744ed31d66SPhilippe Charnier.Fl s
754ed31d66SPhilippe Charnieroption) is displayed, at which
769b50d902SRodney W. Grimestime
771e133604SPhilippe Charnier.Nm
789b50d902SRodney W. Grimesbegins selecting characters from the beginning of
799b50d902SRodney W. Grimes.Ar list
809b50d902SRodney W. Grimesagain.
819b50d902SRodney W. Grimes.Pp
829b50d902SRodney W. GrimesThe following special characters can also be used in list:
839b50d902SRodney W. Grimes.Pp
849b50d902SRodney W. Grimes.Bl -tag -width flag -compact
859b50d902SRodney W. Grimes.It Li \en
869b50d902SRodney W. Grimesnewline character
879b50d902SRodney W. Grimes.It Li \et
889b50d902SRodney W. Grimestab character
899b50d902SRodney W. Grimes.It Li \e\e
909b50d902SRodney W. Grimesbackslash character
919b50d902SRodney W. Grimes.It Li \e0
929b50d902SRodney W. GrimesEmpty string (not a null character).
939b50d902SRodney W. Grimes.El
949b50d902SRodney W. Grimes.Pp
959b50d902SRodney W. GrimesAny other character preceded by a backslash is equivalent to the
969b50d902SRodney W. Grimescharacter itself.
979b50d902SRodney W. Grimes.It Fl s
989b50d902SRodney W. GrimesConcatenate all of the lines of each separate input file in command line
999b50d902SRodney W. Grimesorder.
1009b50d902SRodney W. GrimesThe newline character of every line except the last line in each input
1019b50d902SRodney W. Grimesfile is replaced with the tab character, unless otherwise specified by
1024ed31d66SPhilippe Charnierthe
1034ed31d66SPhilippe Charnier.Fl d
1044ed31d66SPhilippe Charnieroption.
1059b50d902SRodney W. Grimes.El
1069b50d902SRodney W. Grimes.Pp
1079b50d902SRodney W. GrimesIf
1089b50d902SRodney W. Grimes.Ql Fl
1099b50d902SRodney W. Grimesis specified for one or more of the input files, the standard
1109b50d902SRodney W. Grimesinput is used; standard input is read one line at a time, circularly,
1119b50d902SRodney W. Grimesfor each instance of
1129b50d902SRodney W. Grimes.Ql Fl .
11376d70052STim J. Robbins.Sh EXAMPLES
11476d70052STim J. RobbinsList the files in the current directory in three columns:
11576d70052STim J. Robbins.Pp
11676d70052STim J. Robbins.Dl "ls | paste - - -"
11776d70052STim J. Robbins.Pp
11876d70052STim J. RobbinsCombine pairs of lines from a file into single lines:
11976d70052STim J. Robbins.Pp
12076d70052STim J. Robbins.Dl "paste -s -d '\et\en' myfile"
12176d70052STim J. Robbins.Pp
12276d70052STim J. RobbinsNumber the lines in a file, similar to
12376d70052STim J. Robbins.Xr nl 1 :
12476d70052STim J. Robbins.Pp
12576d70052STim J. Robbins.Dl "sed = myfile | paste -s -d '\et\en' - -"
126851623f4SJuli Mallett.Pp
12706e482e6SRuslan ErmilovCreate a colon-separated list of directories named
12806e482e6SRuslan Ermilov.Pa bin ,
12906e482e6SRuslan Ermilovsuitable
130851623f4SJuli Mallettfor use in the
131851623f4SJuli Mallett.Ev PATH
132851623f4SJuli Mallettenvironment variable:
133851623f4SJuli Mallett.Pp
134851623f4SJuli Mallett.Dl "find / -name bin -type d | paste -s -d : -"
1354ed31d66SPhilippe Charnier.Sh DIAGNOSTICS
136d628d776SRuslan Ermilov.Ex -std
1379b50d902SRodney W. Grimes.Sh SEE ALSO
138748dcfb0SGarrett Wollman.Xr cut 1 ,
139748dcfb0SGarrett Wollman.Xr lam 1
1409b50d902SRodney W. Grimes.Sh STANDARDS
1419b50d902SRodney W. GrimesThe
1421e133604SPhilippe Charnier.Nm
1439b50d902SRodney W. Grimesutility is expected to be
1449b50d902SRodney W. Grimes.St -p1003.2
1459b50d902SRodney W. Grimescompatible.
14630f8b6c1STim J. Robbins.Sh HISTORY
14730f8b6c1STim J. RobbinsA
14830f8b6c1STim J. Robbins.Nm
14930f8b6c1STim J. Robbinscommand appeared in
15030f8b6c1STim J. Robbins.At 32v .
15176d70052STim J. Robbins.Sh BUGS
15276d70052STim J. RobbinsMultibyte character delimiters cannot be specified with the
15376d70052STim J. Robbins.Fl d
15476d70052STim J. Robbinsoption.
155