The uniq Command

Finally (at least for now), we’ll look at the uniq program. When sorting data, you will often end up with duplicate lines, lines that are identical. Usually, all you need is one instance of each line. This is where uniq comes in. The uniq program reads its standard input. It prints only one copy of each repeated line. It does have several options. Later on, we’ll use the -c option, which prints each unique line, preceded by a count of the number of times that line occurred in the input.