The "uniq" Utility
Like the comm utility, the "uniq" utility is used to find repetition. However, the "uniq" utility is used to find repeated lines within a file rather than between two files. The "uniq" utility is used to find adjacent duplicate lines and (usually) remove them. The usual syntax looks something like
uniq options filename optional_new_filename
If no optional_new_filename is specified, the output of uniq will be printed to standard output.
As you might expect, it is most common to run the uniq utility after having already sorted the file. Below is an example on how you might use the "uniq" utility.
The "uniq" utility comes with several useful utilities. The more common ones are described below
Consider the following examples