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

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


 uniq(1)                                                             uniq(1)

 NAME    [Toc]    [Back]
      uniq - report repeated lines in a file

 SYNOPSIS    [Toc]    [Back]
      uniq [-udc [-f fields] [-s chars] [input_file [output_file]]

 DESCRIPTION    [Toc]    [Back]
      uniq reads the input text file input_file, comparing adjacent lines,
      and copies the result to output_file.  If input_file is not specified,
      the standard input and standard output are used.  If input_file is
      specified, but output_file is not, results are printed to standard
      output.  input_file and output_file must not be the same file.

    Line-Comparison Options    [Toc]    [Back]
      uniq recognizes the following options when comparing adjacent lines:

           -u      Print only those lines that are not repeated in the
                   original file.

           -d      Print one copy only of each repeated line in the input

           -c      Generate an output report in default style except that
                   each line is preceded by a count of the number of times
                   it occurred.  If this option is specified, the -u and -d
                   options are ignored if either or both are also present.

      If none of the options u, d, or c are present, uniq prints the results
      of the union of the -u and -d options, producing a copy of the
      original input file with the second and succeeding copies of any
      repeated lines removed.  (Note that repeated lines must be adjacent in
      order to be found - see sort(1)).

    Field-Skip Options    [Toc]    [Back]
      Two options are provided for skipping an initial portion of each line
      when making comparisons:

           -f fields      Ignore the first fields fields, together with any
                          blanks before each.  fields is a positive decimal
                          integer.  A field is defined as a string of nonspace,
 non-tab characters separated by tabs and/or
                          spaces from its neighbors.

           -s chars       Ignore the first chars characters.  chars is a
                          positive decimal integer.  Each line in the input
                          is assumed to be terminated with a new line
                          character for purposes of comparison.  Fields are
                          skipped before characters.


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

 uniq(1)                                                             uniq(1)

    Environment Variables    [Toc]    [Back]
      LC_COLLATE must be equal to the value it had when the input files were

      LC_CTYPE determines the interpretation of text within files as singleand/or
 multi-byte characters, and defines a space character when the
      -f or -s option is used.

      LC_MESSAGES determines the language in which messages are displayed.

      If LC_COLLATE, 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, uniq 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]
      Exit values are:

            0      Successful completion.
           >0      Error condition occurred.

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

 SEE ALSO    [Toc]    [Back]
      comm(1), sort(1).

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

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
uniq FreeBSD report or filter out repeated lines in a file
uniq OpenBSD report or filter out repeated lines in a file
uniq Tru64 Removes or lists repeated lines in a file
paste Tru64 Joins corresponding lines of several files or subsequent lines in one file
paste IRIX merge same lines of several files or subsequent lines of one file
paste HP-UX merge same lines of several files or subsequent lines of one file
ulimit IRIX set or report file size limit
dirname NetBSD report the parent directory name of a file pathname
dirname IRIX report the parent directory name of a file pathname
lmver IRIX report the FLEXlm version of a library or binary file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service