-d, -D and -u make sense when used in isolation:
$ printf "1 a\n2 a\n2 b\n2 c\n3 a\n" | uniq -w1 -D
2 a
2 b
2 c
$ printf "1 a\n2 a\n2 b\n2 c\n3 a\n" | uniq -w1 -u
1 a
3 a
pb-laptop:~$ printf "1 a\n2 a\n2 b\n2 c\n3 a\n" | uniq -w1 -d
2 a
However when you combine -u (suppress last output entry
in a repeated group) with -d or -D it doesn't seem useful:
$ printf "1 a\n2 a\n2 b\n2 c\n3 a\n" | uniq -w1 -d -u
$ printf "1 a\n2 a\n2 b\n2 c\n3 a\n" | uniq -w1 -D -u
2 a
2 b
Why I'm asking is to perhaps overload -u -D
to support grouping like:
$ printf "1 a\n2 a\n2 b\n2 c\n3 a\n" |
uniq -w1 --unique=separated --all-repeated=separated
1 a
2 a
2 b
2 c
3 a
Or maybe we should just add a new --group option to do the above?
On a related note, if I want to subsequently split that, I can:
csplit '/^$/' '{*}'
but that leaves the blank lines in the files.
I've often wished there was an option to suppress the matched line.
cheers.
Pádraig.