[BACK]Return to paste.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / paste

Annotation of src/usr.bin/paste/paste.1, Revision 1.12

1.12    ! sobrado     1: .\"    $OpenBSD: paste.1,v 1.11 2007/08/06 19:16:06 sobrado Exp $
1.5       aaron       2: .\"
1.1       deraadt     3: .\" Copyright (c) 1989, 1990 The Regents of the University of California.
                      4: .\" 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.
1.7       millert    18: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    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       5.6 (Berkeley) 7/27/91
                     35: .\"
1.12    ! sobrado    36: .Dd $Mdocdate: August 6 2007 $
1.1       deraadt    37: .Dt PASTE 1
                     38: .Os
                     39: .Sh NAME
                     40: .Nm paste
                     41: .Nd merge corresponding or subsequent lines of files
                     42: .Sh SYNOPSIS
                     43: .Nm paste
                     44: .Op Fl s
                     45: .Op Fl d Ar list
1.11      sobrado    46: .Ar
1.1       deraadt    47: .Sh DESCRIPTION
                     48: The
                     49: .Nm paste
                     50: utility concatenates the corresponding lines of the given input files,
                     51: replacing all but the last file's newline characters with a single tab
                     52: character, and writes the resulting lines to standard output.
                     53: If end-of-file is reached on an input file while other input files
                     54: still contain data, the file is treated as if it were an endless source
                     55: of empty lines.
                     56: .Pp
                     57: The options are as follows:
1.6       aaron      58: .Bl -tag -width Ds
1.5       aaron      59: .It Fl d Ar list
1.1       deraadt    60: Use one or more of the provided characters to replace the newline
                     61: characters instead of the default tab.
                     62: The characters in
                     63: .Ar list
                     64: are used circularly, i.e., when
                     65: .Ar list
                     66: is exhausted the first character from
                     67: .Ar list
                     68: is reused.
                     69: This continues until a line from the last input file (in default operation)
1.3       aaron      70: or the last line in each file (using the
                     71: .Fl s
                     72: option) is displayed, at which
1.1       deraadt    73: time
                     74: .Nm paste
                     75: begins selecting characters from the beginning of
                     76: .Ar list
                     77: again.
                     78: .Pp
                     79: The following special characters can also be used in list:
                     80: .Pp
                     81: .Bl -tag -width flag -compact
                     82: .It Li \en
                     83: newline character
                     84: .It Li \et
                     85: tab character
                     86: .It Li \e\e
                     87: backslash character
                     88: .It Li \e0
1.3       aaron      89: empty string (not a null character)
1.1       deraadt    90: .El
                     91: .Pp
                     92: Any other character preceded by a backslash is equivalent to the
                     93: character itself.
                     94: .It Fl s
                     95: Concatenate all of the lines of each separate input file in command line
                     96: order.
                     97: The newline character of every line except the last line in each input
                     98: file is replaced with the tab character, unless otherwise specified by
1.3       aaron      99: the
                    100: .Fl d
                    101: option.
1.1       deraadt   102: .El
                    103: .Pp
                    104: If
1.5       aaron     105: .Dq -
1.1       deraadt   106: is specified for one or more of the input files, the standard
                    107: input is used; standard input is read one line at a time, circularly,
                    108: for each instance of
1.5       aaron     109: .Dq - .
1.1       deraadt   110: .Pp
1.12    ! sobrado   111: .Ex -std paste
1.8       jmc       112: .Sh EXAMPLES
                    113: List the files in the current directory in three columns:
                    114: .Pp
                    115: .Dl "$ ls | paste - - -"
                    116: .Pp
                    117: Combine pairs of lines from
                    118: .Ar file
                    119: into single lines:
                    120: .Pp
                    121: .Dl "$ paste -s -d '\et\en' file"
                    122: .Pp
                    123: Number the lines in
                    124: .Ar file ,
                    125: similar to
                    126: .Ql cat -n :
                    127: .Pp
                    128: .Dl "$ sed = file | paste -s -d '\et\en' - -"
                    129: .Pp
                    130: Create a colon-separated list of directories named
                    131: .Pa bin ,
                    132: suitable
                    133: for use in the
                    134: .Ev PATH
                    135: environment variable:
                    136: .Pp
                    137: .Dl "$ find / -name bin -type d | paste -s -d : -"
1.1       deraadt   138: .Sh SEE ALSO
                    139: .Xr cut 1
                    140: .Sh STANDARDS
                    141: The
1.9       jmc       142: .Nm
                    143: utility is compliant with the
                    144: .St -p1003.1-2004
                    145: specification.