uniq


uniq

Purpose

Write all unique lines from an input file to standard output.

Syntax

uniq [options] file

Options

-n (where n is a number) ignores the first n fields on each line.

+n (where n is a number) ignores the first n characters on each line.

-c writes the number of times each line occurred in file.

-d writes only duplicate lines.

-u writes only unique lines (the default).

Description

The uniq command removes duplicate lines from an input file and copies the unique lines to the standard output. If you do not specify an input file, uniq reads from standard input.