Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought



CUT(1)          DOMAIN/IX Reference Manual (SYS5)          CUT(1)



NAME
     cut - cut out selected fields from each line of a file

USAGE
     cut -c list [ file1 file2 ... ]
     cut -f list [ -d char ] [ -s ] [ file1 file2 ... ]

DESCRIPTION
     Cut extracts columns from a table or fields from each line
     of a file. The length of the fields specified by list can be
     fixed (i.e., character positions as on a punched card), or
     varied from line-to-line.  They may also be marked with a
     field delimiter character such as tab. You may use cut as a
     filter.  If you specify no files, it reads from the standard
     input.

     Cut is useful, but has its limitations.  To make horizontal
     ``cuts'' through a file and then put the pieces back
     together, you should use the grep (1) and paste (1) commands
     respectively.  You can reorder columns in a table by using
     cut and paste.

OPTIONS
     list      Specify a comma-separated list of integer field
               numbers in increasing order, with an optional dash
               (-) to indicate ranges (e.g., 1,4,7; 1-3,8; -5,10
               (short for 1-5,10); or 3- (short for third through
               last field).

     -clist    Specify a list of character positions (e.g.,
               -c1-72 passes the first 72 characters of each
               line).

     -flist    Specify a list of fields separated in the file by
               a delimiter character (see the -d option); e.g.,
               -f1,7 copies the first and seventh field only.
               Lines with no field delimiters are passed through
               intact (useful for table subheadings), unless -s
               is specified.

     -dchar    Specify the field delimiter equal to character (-f
               option only).  The default is tab.  A space or
               other characters with special meaning to the Shell
               must be quoted.

     -s        Suppress lines with no delimiter characters in
               case of the -f option.  Unless specified, lines
               with no delimiters are passed through untouched.

EXAMPLES
     To map user IDs to names, type the following:




Printed 6/10/85                                             CUT-1





CUT(1)          DOMAIN/IX Reference Manual (SYS5)          CUT(1)



          cut -d: -f1,5 /etc/passwd

     To set name to your current log-in name (this is run in the
     Shell), type the following:

          name=`who am i | cut -f1

CAUTIONS
     You must always specify either the -c or -f option on a cut
     command line.

DIAGNOSTICS
     ``line too long''
          The line contains more than 1023 characters or fields.

     ``bad list for c/f option''
          Missing a -c or -f option or a correctly-specified
          list.  No error occurs if a line has fewer fields than
          the list calls for.

     ``no fields''
          The list is empty.

RELATED INFORMATION
     grep (1), paste (1).






























CUT-2                                             Printed 6/10/85



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026