[PATCH]: uniq: add "--group" option (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Assaf Gordon |
---|---|
Subject: | [PATCH]: uniq: add "--group" option |
Date: | Wed, 20 Feb 2013 13:44:07 -0500 |
User-agent: | 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.html http://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
0001-uniq-add-group-option.patch
Description: Text Data
- [PATCH]: uniq: add "--group" option,Assaf Gordon <=
- Re: [PATCH]: uniq: add "--group" option, Pádraig Brady, 2013/02/20
* Re: [PATCH]: uniq: add "--group" option, Assaf Gordon, 2013/02/21
* Re: [PATCH]: uniq: add "--group" option, Pádraig Brady, 2013/02/21
* Re: [PATCH]: uniq: add "--group" option, Assaf Gordon, 2013/02/21
* Re: [PATCH]: uniq: add "--group" option, Assaf Gordon, 2013/02/21
* Re: [PATCH]: uniq: add "--group" option, Pádraig Brady, 2013/02/27
* Re: [PATCH]: uniq: add "--group" option, Assaf Gordon, 2013/02/28
* Re: [PATCH]: uniq: add "--group" option, Pádraig Brady, 2013/02/28
- Re: [PATCH]: uniq: add "--group" option, Pádraig Brady, 2013/02/20
- Prev by Date:Re: [Patch] expand,unexpand multibyte support
- Next by Date:Re: [PATCH]: uniq: add "--group" option
- Previous by thread:[PATCH] dircolors.hin: add .cab, .alz, .lzo, .lrz, .t7z, .tzo and .lha to colorized archives
- Next by thread:Re: [PATCH]: uniq: add "--group" option
- Index(es):