uniq
uniq [-c] [-d |-u] [-i] [-f n] [-s n] [input [output]]
Ignore all but one of successive identical lines from input
(or standard input),
writing to output
(or standard output).
Compares adjacent lines and writes unique (or duplicate) lines
Beware of trailing blankes on SOME lines.
-c |
Seems that the delimiter MUST be whitespace. Maybe sed "s/,/+ +/" | uniq | sed "s/+ +/,/"
cat 00 11 11 2 3 4 44 44 5 uniq 00 11 2 3 4 44 5 uniq -c 00 2 11 1 2 1 3 1 4 2 44 1 5 cat 00 11 11 2 3 4 44 44 5 uniq -u 00 2 3 4 5 cat 00 11 11 2 3 4 44 44 5 uniq -D 00 11 11 44 44
tersified by Dennis German
If input
is a single dash (-
) or absent, the stdout is read.
Only adjacent lines are compared, so it may be necessary to sort the file(s) first.
Beware of trailing blanks on SOME lines.
> cat -n ffff 1 11 2 11 3 2 4 3 5 4 6 44 7 44 8 5 |
$LANG, $LC_ALL, $LC_COLLATE
and
$LC_CTYPE
affect the execution as described in environ