Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

CUT(1V)                                                                CUT(1V)

       cut - remove selected fields from each line of a file

       cut -clist [ filename ...  ]

       cut -flist [ -dc ] [ -s ] [ filename ...  ]

       This  command  is  available  with  the  System V software installation
       option.  Refer to for information on how to install optional software.

       Use cut to cut out columns from a table or fields from each line  of  a
       file;  in  data  base parlance, it implements the projection of a rela-
       tion.  The fields as specified by list can be of fixed length, (such as
       on  a  punched card), or of variable length between lines.  They can be
       marked with a field delimiter character, such as TAB (as specified with
       the  -d  option).   cut can be used as a filter; if no files are given,
       the standard input is used.  In addition, a file name of `-' explicitly
       refers to the standard input.

       -clist By  character position.  list is a comma-separated list of inte-
              ger field numbers (in increasing order), with an optional `-' to
              indicate ranges:

              1,4,7  characters 1, 4 and 7
              1-3,8  characters 1 through 3, and 8
              -5,10  characters (1) through 5, and 10
              3-     characters 3 through (last)

       -flist By  field position.  Instead of character positions, list speci-
              fies fields that are separated a delimiter (normally a TAB):

              1,4,7  fields 1, 4 and 7

              Lines with no  field  delimiters  are  normally  passed  through
              intact (to allow for subheadings).

       -dc    Set the field delimiter to c.  The default is a TAB.  Characters
              with special meaning to the shell such as a TAB or SPACE charac-
              ters, must be quoted.

       -s     Suppress lines with no delimiter characters.

        cut -d: -f1,5 /etc/passwd
                   Mapping of user IDs to names.

       name=who am i | cut -f1 -d" "
                   Set name to the current login name.

       grep(1V), paste(1V)

       ERROR:  line too long
                   A line can have no more than 1023 characters or fields.
       ERROR:  bad list for c/f option
                   Missing  -c or -f option or incorrectly specified list.  No
                   error occurs if a line has fewer fields than the list calls
       ERROR:  no fields
                   The list is empty.
       ERROR:  no delimiter
                   Missing char on -d option.
       ERROR:  cannot handle multiple adjacent backspaces
                   Adjacent backspaces cannot be processed correctly.
       WARNING:  cannot open filename: reason
                   Either  filename cannot be read or does not exist.  If mul-
                   tiple filenames are present, processing continues.
       WARNING:  I/O error reading filename: reason
                   An I/O error occurred when reading filename.   If  multiple
                   filenames are present, processing continues.

                               16 September 1989                       CUT(1V)