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 ] [ -dlist ] 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
          (-c option), or be marked with a delimiter character (-f
          option).

          The meanings of the options follow.  A list is a comma-
          separated, increasing list of integers with optional - to
          indicate ranges, 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 the -f option.
                   Default is tab.

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

          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 tab characters, or with characters taken circularly
          from an optionally specified list. The list may contain the
          special escape sequences \n (newline), \t (tab), \\ (back-
          slash), and \0 (empty string, not a null character).

          Option -s causes paste to combine successive lines from one
          file rather than corresponding lines from multiple files.

     EXAMPLES
          cut -d: -f1,3 /etc/passwd
               mapping of login names to userids

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

     CUT(1)                                                     CUT(1)

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

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

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