uniq -- Filtering Duplicates

The uniq utility can be used to filter adjacent duplicate lines in files or in the text provided through standard input.

See man uniq and IEEE1003.1-2004-uniq for details.