[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: uniq: add "--group" option

From: Assaf Gordon
Subject: Re: [PATCH]: uniq: add "--group" option
Date: Thu, 21 Feb 2013 11:37:30 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Pádraig Brady wrote, On 02/21/2013 11:11 AM:
> On 02/21/2013 03:42 PM, Assaf Gordon wrote:
>> Hello Pádraig,
>> Pádraig Brady wrote, On 02/20/2013 08:47 PM:
>>> On 02/20/2013 06:44 PM, Assaf Gordon wrote:
>>>> Hello,
>>>> Attached is a suggestion for "--group" option in uniq, as
>>>> discussed here: 

[ ... ]

>>> So on to operation...
>>>> And it behaves "as expected": === $ printf "a\na\na\nb\nc\nc\n"
>>>> | ./src/uniq --group-sep="--" --group=separate
>>> The above isn't that useful and could be done with sed.
>> I assume you're specifically referring to the "group-sep" part -
>> then OK.
> Actually I was referring to the fact that in your example --group
> didn't output all entries by default. If it only output unique
> entries then you can separate with:
> uniq | sed 'G'     # (note sed also supports -z) uniq | sed '$q;G'
> So `uniq --group` should output all items by default I think.
[ ... ]
>> I guess it's true from a technical POV - but again, for downstream
>> analysis convenience it's nice to have a fixed end-of-group
>> marker. I could use the same downstream script (which expects
>> end-of-group markers) with uniq, whether I used "-d" or "-u" or
>> nothing at all.
> But what's the point in such processing if there is only ever going 
> to be a single line in each group?

I see now,

I was thinking of "--group" as simply an output modifier (ie "add group marker 
to whatever uniq is outputing"), allowing combination of "--group" with 
-u/-d/-D or any other option (whether it made useful sense or not).

You were planning on "--group" to mean explicitly "output all input lines, and 
add group-markers for unique groups" (meaning -u/-d/-D and --group are mutually 

I can go on with your definition. I'll send update soon.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]