sbase/uniq.1

46 lines
1.0 KiB
Groff

.Dd January 30, 2015
.Dt UNIQ 1
.Os sbase
.Sh NAME
.Nm uniq
.Nd report or filter out repeated lines in a file
.Sh SYNOPSIS
.Nm
.Op Fl cdu
.Op Ar file
.Sh DESCRIPTION
.Nm
reads
.Ar file
and writes one copy of a line from each group of consecutive
duplicate lines to stdout. If no
.Ar file
is given,
.Nm
reads from stdin.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl c
Prefixes each line with a count of its consecutive occurrences in the input.
.It Fl d
Suppresses non-duplicate lines (thus 'uniq -d' prints only duplicates).
.It Fl u
Suppresses non-unique lines (thus 'uniq -u' prints only uniques).
.El
.Sh BUGS
The original sbase implementation of
.Nm
supported multiple input-file arguments as e.g.
.Xr cat 1
and
.Xr grep 1
do.
Unfortunately, POSIX uniq treats its second argument (if present) as an
output filename and clobbers it. Since users and scripts which rely on
.Nm
supporting multiple input-file arguments would be at risk of data loss
if they ever ran into a POSIX-compatible
.Nm
, support for multiple input-file arguments was removed from this
implementation.