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 file1 and file2 line-by-line and by default filters out repeating lines.

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>

2024-05-02 Linux 6.6.67-gentoo-x86_64