UNIQ(1) General Commands Manual UNIQ(1)

uniqreport or filter out duplicated lines

uniq [-c|-d|-u] [-f field_shift] [-s byte_shift] [input_file [output_file]]

The uniq utility reads input_file line-by-line and by default filters out repeating lines.

If no input_file is given or if input_file is "-", uniq reads from the standard input. If no output_file is given or if output_file is "-", uniq writes to the standard output.

The following options are supported:

Prefix lines with how many times they are duplicated.
Only write duplicated lines (count > 1).
field_shift
Shift the compared line by field_shift amount of fields, where a field is ⟨blank⟩ separated.
byte_shift
Shift the compared lines by byte_shift. If field_shift was also specified, it provides an additional shift.
Only write unique lines (count == 1).

The uniq utility exits 0 on success, and >0 if an error occurs.

uniq should be compliant with the IEEE Std 1003.1-2024 (“POSIX.1”) specification.

Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>

January 22, 2025 Linux