*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> paste (1)              


 paste(1)                                                           paste(1)

 NAME    [Toc]    [Back]
      paste - merge same lines of several files or subsequent lines of one

 SYNOPSIS    [Toc]    [Back]
      paste file1 file2 ...

      paste -d list file1 file2 ...

      paste -s [-d list] file1 file2 ...

 DESCRIPTION    [Toc]    [Back]
      In the first two forms, paste concatenates corresponding lines of the
      given input files file1, file2, etc.  It treats each file as a column
      or columns in a table and pastes them together horizontally (parallel
      merging).  In other words, it is the horizontal counterpart of cat(1)
      which concatenates vertically; i.e., one file after the other.  In the
      -s option form above, paste replaces the function of an older command
      with the same name by combining subsequent lines of the input file
      (serial merging).  In all cases, lines are glued together with the tab
      character, or with characters from an optionally specified list.
      Output is to standard output, so paste can be used as the start of a
      pipe, or as a filter if - is used instead of a file name.

      paste recognizes the following options and command-line arguments:

           -d        Without this option, the new-line characters of all but
                     the last file (or last line in case of the -s option)
                     are replaced by a tab character.  This option allows
                     replacing the tab character by one or more alternate
                     characters (see below).

           list      One or more characters immediately following -d replace
                     the default tab as the line concatenation character.
                     The list is used circularly; i.e., when exhausted, it
                     is reused.  In parallel merging (that is, no -s
                     option), the lines from the last file are always
                     terminated with a new-line character, not from the
                     list.  The list can contain the special escape
                     sequences: \n (new-line), \t (tab), \\ (backslash), and
                     \0 (empty string, not a null character).  Quoting may
                     be necessary if characters have special meaning to the
                     shell.  (For example, to get one backslash, use -

           -s        Merge subsequent lines rather than one from each input
                     file.  Use tab for concatenation, unless a list is
                     specified with the -d option.  Regardless of the list,
                     the very last character of the file is forced to be a

 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003

 paste(1)                                                           paste(1)

           -         Can be used in place of any file name to read a line
                     from the standard input (there is no prompting).

    Environment Variables
      LC_CTYPE determines the locale for the interpretation of text as
      single- and/or multi-byte characters.

      LC_MESSAGES determines the language in which messages are displayed.

      If LC_CTYPE or LC_MESSAGES is not specified in the environment or is
      set to the empty string, the value of LANG is used as a default for
      each unspecified or empty variable.  If LANG is not specified or is
      set to the empty string, a default of "C" (see lang(5)) is used
      instead of LANG.

      If any internationalization variable contains an invalid setting,
      paste behaves as if all internationalization variables are set to "C".
      See environ(5).

    International Code Set Support    [Toc]    [Back]
      Single- and multi-byte character code sets are supported.

 RETURN VALUE    [Toc]    [Back]
      These commands return the following values upon completion:

           0    Completed successfully.

           >0   An error occurred.

 EXAMPLES    [Toc]    [Back]
      List directory in one column:

           ls | paste -d" " -

      List directory in four columns

           ls | paste - - - -

      Combine pairs of lines into lines

           paste -s -d"\t\n" file

    Notes    [Toc]    [Back]
      pr -t -m...  works similarly, but creates extra blanks, tabs and newlines
 for a nice page layout.

 DIAGNOSTICS    [Toc]    [Back]
      too many files           Except for the -s option, no more than
                               OPEN_MAX - 3 input files can be specified
                               (see limits(5)).

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003

 paste(1)                                                           paste(1)

 AUTHOR    [Toc]    [Back]
      paste was developed by OSF and HP.

 SEE ALSO    [Toc]    [Back]
      cut(1), grep(1), pr(1).

      paste: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
paste OpenBSD merge corresponding or subsequent lines of files
paste FreeBSD merge corresponding or subsequent lines of files
paste Tru64 Joins corresponding lines of several files or subsequent lines in one file
paste Linux merge lines of files
join Tru64 Joins the lines of two files
nl Linux number lines of files
head OpenBSD display first few lines of files
sort Linux sort lines of text files
sort FreeBSD sort lines of text files
comm OpenBSD select or reject lines common to two files
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service