Subject: bug#5832: Feature request: uniq -k

From: Raphael Clifford <[email-masked]>
Date: Mon, 5 Apr 2010 10:10:46 +0100

Yes http://lists.gnu.org/archive/html/bug-coreutils/2006-06/msg00211.html
in particular is pretty much exactly the same feature request.

What is the current thinking on this?

Raphael

On 4 April 2010 05:22, Steve Ward <[email-masked]> wrote:
> This might be relevant:
>
> uniq: missing option -W / --check-fields=N
> http://lists.gnu.org/archive/html/bug-coreutils/2006-06/msg00168.html
>
>
>
> Steve
>
>
> On Sat, Apr 3, 2010 at 14:39, Raphael Clifford <[email-masked]> wrote:
>>
>> Please excuse the cross-post but I have been told this is the
>> appropriate place to place a feature request.
>>
>> Is it possible to make a feature request for uniq to add the "-k"
>> option to specify
>> fields?  Interestingly uniq already has such things as
>>
>> -f, --skip-fields=N
>>             avoid comparing the first N fields
>> and
>>
>>  -s, --skip-chars=N
>>             avoid comparing the first N characters
>>
>> but no explicit option to specify which fields should be considered
>> when doing the comparison.  This would be very useful, for example,
>> when removing duplicates from time series data (where you are only
>> worried about consecutive duplicates on certain fields).  The awk
>> equivalent would be something like
>>
>> awk '$2$3$4$5 !=  p; {p=$2$3$4$5}'
>>
>> for using fields 2 to 5 as comparators.
>>
>> Raphael
>>
>> P.S. http://www.opengroup.org/onlinepubs/9699919799/utilities/uniq.html
>> is the posix specification for uniq if that is of any interest.
>> Curiously it says nothing about which duplicate line to keep when you
>> don't consider all fields in the comparison.
>>
>>
>>
>>
>>
>
>