Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4
Hello,
Attached is a suggestion for "--group" option in uniq, as discussed here:
http://lists.gnu.org/archive/html/coreutils/2011-03/msg00000.htmlhttp://lists.gnu.org/archive/html/coreutils/2012-03/msg00052.html
The patch adds two parameters:
--group=[method] separate each unique line (whether duplicated or not)
with a marker.
method={none,separate(default),prepend,append,both)
--group-separator=SEP with --group, separates group using SEP
(default: empty line)
And it behaves "as expected":
===
$ printf "a\na\na\nb\nc\nc\n" | ./src/uniq --group-sep="--" --group=separate
a
--
b
--
c
$ printf "a\na\na\nb\nc\nc\n" | ./src/uniq --group-sep="--" --group=both
--
a
--
b
--
c
--
$ printf "a\na\na\nb\nc\nc\n" | ./src/uniq --group-sep="--" --group=prepend
--
a
--
b
--
c
$ printf "a\na\na\nb\nc\nc\n" | ./src/uniq -D --group-sep="--" --group=both
--
a
a
a
--
c
c
--
===
The added tests check all sorts of combinations.
If this is the right direction, I'll send an updated patch (with
NEWS/docs/etc.).
-gordon