man(1) Manual page archive


     CUT(1)                                                     CUT(1)

     NAME
          cut, paste - rearrange columns of data

     SYNOPSIS
          cut -clist [ file ... ]

          cut -flist [ -dchar ] [ file ... ]

          paste [ -s ] [ -dchars ] file ...

     DESCRIPTION
          Cut selects fields from each line of the files (standard
          input default).  In data base parlance, it projects a rela-
          tion.  The fields can be fixed length, as on a punched card
          (option -c), or be marked with a delimiter character (option
          -f).

          The meanings of the options follow.  A list is an increasing
          sequence of integers separated by commas, or by - to indi-
          cate a range, for example `1,3-5,7.'

          -clist     The list specifies character positions.

          -flist     The list specifies field numbers.

          -dchar     The character is the delimiter for option -f.
                     Default is tab.

          -s         Suppress lines with no delimiter characters.
                     Normally such lines pass through untouched under
                     option -f.

          Paste concatenates corresponding lines of the input files
          and places the result on the standard output.  The file name
          `-' refers to the standard input.  Lines are glued together
          with characters taken circularly from the set chars. The set
          may contain the special escape sequences \n (newline), \t
          (tab), \\ (backslash), and \0 (empty string, not a null
          character).  The options are

          -dchars
               The output separator characters.  Default is a tab.

          -s   Paste together lines of one file, treating every line
               as if it came from a distinct input.

     EXAMPLES
          cut -d: -f1,3 /etc/passwd
               Print map from login names to userids, see passwd(5).

     CUT(1)                                                     CUT(1)

          NAME=`who am i | cut -f1 -d" "`
               Set `NAME' to current login name (subtly different from
               getuid(1)).

          ls | paste - - - -
          ls | paste -s '-d\t\n' -
               4-column and 2-column file listing

     SEE ALSO
          gre(1), awk(1), sed(1), pr(1), column(1)

     BUGS
          Cut should handle disordered lists under option -f.
          In default of file names, paste should read the the standard
          input.