Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cut(1) — mips UMIPS RISC/os 5.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

grep(1)

paste(1)



CUT(1)              RISC/os Reference Manual               CUT(1)



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

SYNOPSIS
     cut -clist [file ...]
     cut -flist [-dchar] [-s] [file ...]

DESCRIPTION
     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 relation.  The fields as specified by list
     can be fixed length, i.e., character positions as on a
     punched card (c option) or the length can vary from line to
     line and be marked with a field delimiter character like tab
     (f 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 standard input.

     The meanings of the options are:

     list     A comma-separated list of integer field numbers (in
              increasing order), with optional - 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    The list following c (no space) specifies character
              positions (e.g., -c1-72 would pass the first 72
              characters of each line).

     flist    The list following f is a list of fields assumed to
              be separated in the file by a delimiter character
              (see d ); e.g., -fR,7 copies the first and seventh
              field only.  Lines with no field delimiters will be
              passed through intact (useful for table subhead-
              ings), unless s is specified.

     dchar    The character following d is the field delimiter (f
              option only).  Default is tab.  Space or other
              characters with special meaning to the shell must
              be quoted.

     s        Suppresses lines with no delimiter characters in
              case of f option.  Unless specified, lines with no
              delimiters will be passed through untouched.

     Either the c or f option must be specified.

     Use grep(1) to make horizontal cuts (by context) through a
     file, or paste(1) to put files together column-wise (i.e.,
     horizontally).  To reorder columns in a table, use cut and
     paste.




                        Printed 11/19/92                   Page 1





CUT(1)              RISC/os Reference Manual               CUT(1)



INTERNATIONAL FUNCTIONALITY
     cut can process characters from supplementary code sets.

     Options:

     clist
          Positions list must be specified as column positions
          rather than characters.  When multibyte characters are
          split at a specified position, the remaining column
          positions are filled with an appropriate number of
          ASCII spaces instead of characters.

     dchar
          The field delimiter char can be a character from a sup-
          plementary code set.

EXAMPLES
     cut -d: -fR,5 /etc/passwd
                           mapping of user IDs to names

     name=`who am i | cut -fR -d" "`
                           to set name to current login name.

DIAGNOSTICS
     "ERROR:  line too long"
                   A line can have no more than 1023 characters
                   or fields, or there is no new-line character.

     "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 for.























 Page 2                 Printed 11/19/92





CUT(1)              RISC/os Reference Manual               CUT(1)



     "ERROR:  no fields"
                   The list is empty.

     "ERROR:  no delimeter"
                   Missing char on d option.

     "ERROR:  cannot handle multiple adjacent backspaces"
                   Adjacent backspaces cannot be processed
                   correctly.

     "WARNING:  cannot open <filename>"
                   Either filename cannot be read or does not
                   exist.  If multiple filenames are present,
                   processing continues.

SEE ALSO
     grep(1), paste(1).






































                        Printed 11/19/92                   Page 3



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