home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 329_01 / cut.doc < prev    next >
Text File  |  1988-12-09  |  4KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                       (last mod. 8/19/84)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      CUT(1)             UNIX 4.0            CUT(1)
  71.  
  72.  
  73.  
  74.      NAME
  75.       cut -    cut out    selected fields    of each    line of    a file
  76.  
  77.      SYNOPSIS
  78.       cut -clist [file1 file2 ...]
  79.       cut -flist [-d char] [-s] [file1 file2 ...]
  80.  
  81.      DESCRIPTION
  82.       Use cut to cut out columns from a table or fields from each
  83.       line of a file; in data base parlance, it implements the
  84.       projection of    a relation.  The fields    as specified by    list
  85.       can be fixed length, i.e., character positions as on a
  86.       punched card (-c option), or the length can vary from    line
  87.       to line and be marked    with a field delimiter character like
  88.       tab (-f option).  Cut    can be used as a filter; if no files
  89.       are given, the standard input    is used.
  90.  
  91.       The meanings of the options are:
  92.  
  93.       list
  94.        A comma-separated list of integer field numbers (in
  95.        increasing order), with optional - to indicate ranges as in
  96.        the -o option of nroff/troff    for page ranges; e.g., 1,4,5;
  97.        1-3,8; -5,10    (short for 1-5,10P); or    3- (short for third
  98.        through last    field).
  99.  
  100.       -clist
  101.        The list following -c (no space) specifies character
  102.        positions (e.g., -c1-72 would pass the first    72 characters
  103.        of each line).
  104.  
  105.       -flist
  106.        The list following -f is a list of fields assumed to    be
  107.        separated in    the file by a delimiter    character (see -d);
  108.        e.g., -f1,7 copies the first    and seventh field only.     Lines
  109.        with    no field delimiters will be passed through intact
  110.        (useful for table subheadings), unless -s is    specified.
  111.  
  112.       -dchar
  113.        The character following -d is the field delimiter (-f
  114.        option only).  Default is tab.  Space or other characters
  115.        with    special    meaning    to the shell must be quoted.
  116.  
  117.       -s
  118.        Supresses lines with    no delimiter characters    in case    of -f
  119.        option.  Unless specified, lines with no delimiters will be
  120.        passed through untouched.
  121.  
  122.       Either the -c    or -f option must be specified.
  123.  
  124.      HINTS
  125.       Use grep(1) to make horizontal "cuts"    (by context) through a
  126.  
  127.  
  128.  
  129.      Page 1                       (last mod. 8/19/84)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      CUT(1)             UNIX 4.0            CUT(1)
  137.  
  138.  
  139.  
  140.       file or paste(1) to put files    together column-wise (i.e.,
  141.       horizontally).  To reorder columns in    a table, use cut and
  142.       paste.
  143.  
  144.      EXAMPLESS
  145.       cut -d: -f1,5    /etc/passwd
  146.         mapping of user IDs    to names
  147.  
  148.       name=`who am i | cut -f1 -d:`
  149.         to set name    to current login name
  150.  
  151.      DIAGNOSTICS
  152.       line too long
  153.         A line can have no more than 511 characters    or fields.
  154.  
  155.       bad list for c/f option
  156.         Missing -c or -f option or incorrectly specified list.  No
  157.         error occurs if a line has fewer fields than the list
  158.         calls for.
  159.  
  160.       no fields
  161.         The    list is    empty.
  162.  
  163.      SEE ALSO
  164.       grep(1),paste(1).
  165.  
  166.      CAVEATS
  167.       This program is a complete rewrite of    the Bell Laboratories
  168.       command of the same name; no part of the original source or
  169.       manual is included.  Therefore, you may feel free to use it,
  170.       and its source, without violation of any contract
  171.       agreements.  However,    I retain the copyright in order    to
  172.       specify it remain available for use by all and sundry,
  173.       without cost.     Feel free to modify as    necessary, although I
  174.       went to great    pains to recreate the behavior of the original
  175.       command; I would suggest this    congruence be maintained.
  176.  
  177.       Along    the same lines,    although I've made a reasonable    effort
  178.       to test the more arcane behavior of the original cut and
  179.       reproduce it,    there are no guarantees.  I remain in no way
  180.       liable for any loss, either explicit or incidental, that may
  181.       be incurred through use of this command.  I do ask that any
  182.       bugs (and, hopefully,    fixes) be reported back    to me as
  183.       encountered. - David M. Ihnat, ihuxx!ignatz
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 2                       (last mod. 8/19/84)
  196.  
  197.  
  198.  
  199.