O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

uniq

Displays lines of a file that are unique

uniq [options] [input-file] [output-file]

The uniq utility displays a file, removing all but one copy of successive repeated lines. If the file has been sorted (refer to the sort utility), uniq ensures that no two lines that it displays are the same.

Arguments

When you do not specify the input-file, uniq uses standard input. When you do not specify the output-file, uniq uses standard output.

Options

A field is a sequence of characters bounded by SPACE s, TABs, NEWLINEs, or a combination of these.

--count

-c Precedes each line with the number of occurrences of the line in the input file.

--ignore-case

-i Ignores case when comparing lines.

--repeated

-d Displays one copy of lines that are repeated; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required