codeaprendiz.github.io

DevOps Essentials

View on GitHub

uniq

NAME

uniq – report or filter out repeated lines in a file

SYNOPSIS

uniq [-c -d -u] [-i] [-f num] [-s chars] [input_file [output_file]]

DESCRIPTION

The uniq utility reads the specified input_file comparing adjacent lines, and writes a copy of each unique input line to the output_file. If input_file is a single dash (`-‘) or absent, the standard input is read. If output_file is absent, standard output is used for output. The second and succeeding copies of identical adjacent input lines are not written. Repeated lines in the input will not be detected if they are not adjacent, so it may be necessary to sort the files first.

OPTIONS

The following options are available:

$ cat testFile 
One Two
One Two
One Two Three Four
One Two Three Four
One Two Three Four
One
One 1
m-C02SN6PVG8WN:~ asr000p$ uniq testFile 
One Two
One Two Three Four
One
One 1
$