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

Annotation of src/usr.bin/cut/cut.1, Revision 1.20

1.20    ! sobrado     1: .\"    $OpenBSD: cut.1,v 1.19 2012/06/10 06:22:56 jmc Exp $
1.1       deraadt     2: .\"    $NetBSD: cut.1,v 1.6 1995/10/02 20:19:26 jtc Exp $
                      3: .\"
                      4: .\" Copyright (c) 1989, 1990, 1993
                      5: .\"    The Regents of the University of California.  All rights reserved.
                      6: .\"
                      7: .\" This code is derived from software contributed to Berkeley by
                      8: .\" the Institute of Electrical and Electronics 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.8       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: .\"     @(#)cut.1      8.1 (Berkeley) 6/6/93
                     35: .\"
1.20    ! sobrado    36: .Dd $Mdocdate: June 10 2012 $
1.1       deraadt    37: .Dt CUT 1
                     38: .Os
                     39: .Sh NAME
                     40: .Nm cut
                     41: .Nd select portions of each line of a file
                     42: .Sh SYNOPSIS
                     43: .Nm cut
                     44: .Fl b Ar list
                     45: .Op Fl n
                     46: .Op Ar
                     47: .Nm cut
                     48: .Fl c Ar list
                     49: .Op Ar
                     50: .Nm cut
                     51: .Fl f Ar list
1.13      sobrado    52: .Op Fl s
1.1       deraadt    53: .Op Fl d Ar delim
                     54: .Op Ar
                     55: .Sh DESCRIPTION
                     56: The
1.5       aaron      57: .Nm
1.1       deraadt    58: utility selects portions of each line (as specified by
1.6       aaron      59: .Ar list )
1.1       deraadt    60: from each
                     61: .Ar file
                     62: (or the standard input by default), and writes them to the
                     63: standard output.
                     64: The items specified by
                     65: .Ar list
                     66: can be in terms of column position or in terms of fields delimited
1.6       aaron      67: by a special character.
1.19      jmc        68: Column and field numbering starts from 1.
1.1       deraadt    69: .Pp
1.3       aaron      70: .Ar list
1.16      schwarze   71: is a comma or whitespace separated set of numbers and/or
1.1       deraadt    72: number ranges.
                     73: Number ranges consist of a number, a dash
1.3       aaron      74: .Pq Sq \- ,
1.1       deraadt    75: and a second number
1.6       aaron      76: which select the fields or columns from the first number to the second,
1.1       deraadt    77: inclusive.
                     78: Numbers or number ranges may be preceded by a dash, which selects all
                     79: fields or columns from 1 to the first number.
                     80: Numbers or number ranges may be followed by a dash, which selects all
                     81: fields or columns from the last number to the end of the line.
                     82: Numbers and number ranges may be repeated, overlapping, and in any order.
                     83: It is not an error to select fields or columns not present in the
                     84: input line.
                     85: .Pp
                     86: The options are as follows:
1.7       aaron      87: .Bl -tag -width Ds
1.1       deraadt    88: .It Fl b Ar list
1.4       aaron      89: The
1.1       deraadt    90: .Ar list
                     91: specifies byte positions.
                     92: .It Fl c Ar list
                     93: The
                     94: .Ar list
                     95: specifies character positions.
1.10      jmc        96: .It Fl d Ar delim
1.1       deraadt    97: Use the first character of
1.10      jmc        98: .Ar delim
1.14      jmc        99: as the field delimiter character.
                    100: The default is the
                    101: .Aq TAB
                    102: character.
1.1       deraadt   103: .It Fl f Ar list
                    104: The
                    105: .Ar list
1.14      jmc       106: specifies fields, separated by the field delimiter character.
                    107: The selected fields are output,
                    108: separated by the field delimiter character.
1.1       deraadt   109: .It Fl n
                    110: Do not split multi-byte characters.
                    111: .It Fl s
                    112: Suppresses lines with no field delimiter characters.
                    113: Unless specified, lines with no delimiters are passed through unmodified.
                    114: .El
1.17      jmc       115: .Sh EXIT STATUS
1.18      jmc       116: .Ex -std cut
1.9       jmc       117: .Sh EXAMPLES
                    118: Extract login names and shells from the system
                    119: .Xr passwd 5
                    120: file as
                    121: .Dq name:shell
                    122: pairs:
                    123: .Pp
                    124: .Dl "$ cut -d : -f 1,7 /etc/passwd"
                    125: .Pp
                    126: Show the names and login times of logged in users:
                    127: .Pp
1.20    ! sobrado   128: .Dl "$ who | cut -c 1-8,18-30"
1.1       deraadt   129: .Sh SEE ALSO
                    130: .Xr paste 1
                    131: .Sh STANDARDS
                    132: The
1.5       aaron     133: .Nm
1.11      jmc       134: utility is compliant with the
1.15      jmc       135: .St -p1003.1-2008
1.11      jmc       136: specification.
1.16      schwarze  137: .Sh CAVEATS
                    138: The current implementation does not support multi-byte characters.
                    139: Consequently
                    140: .Fl c
                    141: does the same as
                    142: .Fl b ,
                    143: and
                    144: .Fl n
                    145: has no effect.