uniq(1)								      uniq(1)



NAME

  uniq - Removes or lists repeated lines in a file

SYNOPSIS

  uniq [-cdu] [-f fields] [-s chars] [-fields] [+chars] [input-file
  [output-file]]

  The uniq command reads from standard input (default), or from the specified
  input_file, compares adjacent lines, removes the second and succeeding
  occurrences of a line, and writes to standard output or to the specified
  file output_file.

FLAGS

  -c  Precedes each output line with a count of the number of times each line
      appears in the file.  This flag supersedes -d and -u.

  -d  Displays repeated lines only.

  -f fields
      Ignores the first fields fields on each input line when doing comparis-
      ons, where fields is a positive decimal integer.	A field is the maxi-
      mal string matched by the basic regular expression:
	   [[:blank:]]*[^[:blank:]]*

      If the fields argument specifies more fields than appear on an input
      line, a null string is used for comparisons.

  -s chars
      Ignores the specified number of characters when doing comparisons.  The
      chars argument is a positive decimal integer.

      If specified with the -f flag, the first chars characters after the
      first fields fields are ignored.	If the chars argument specifies more
      characters than remain on an input line, uniq uses a null string for
      comparison.

  -u  Displays unique lines only.

  -fields
      Equivalent to -f fields. (Obsolescent)

  +chars
      Equivalent to -s chars. (Obsolescent)

DESCRIPTION

  The input_file and output_file arguments must be different files.  If the
  input_file operand is not specified, or if it is -, uniq uses standard
  input.

  Repeated lines must be on consecutive lines to be found.  You can arrange
  them with the sort command before processing.




EXAMPLES

  To delete repeated lines in the following file called fruit and save it to
  a file named newfruit, enter:

       uniq fruit newfruit

  The file fruit contains the following lines:

       apples
       apples
       bananas
       cherries
       cherries
       peaches
       pears

  The file newfruit contains the following lines:

       apples
       bananas
       cherries
       peaches
       pears


RELATED INFORMATION

  Commands:  comm(1), sort(1).