In this article we discuss using the uniq command to print or remove adjacent duplicated lines. We also discuss the different between uniq and sort -u, which are often compared as having the same functionality.
Source: LXer – Linux uniq Command Usage and How It Differs from Sort -u