bug-coreutils
[Top][All Lists]
Advanced

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

bug#17022: Dosen't work properly option -u of uniq


From: Pádraig Brady
Subject: bug#17022: Dosen't work properly option -u of uniq
Date: Wed, 19 Mar 2014 18:04:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 03/17/2014 10:41 AM, Pádraig Brady wrote:
> On 03/17/2014 05:06 AM, Александр Ботов wrote:
>> Good day!
>>
>> I've tried to use option -uD to discard the first repeated line as it 
>> written in info, but it discards the last one.
>>
>> In the info said that for this purpose I should use option -u not by itself, 
>> but doesn't said what dose it mean. Could you said (and may be add to the 
>> man/info) how to use option -u to discard _the first_ repeated line, please?
>>
>> I use Scientific Linux SL release 5.4 (Boron), Linux version 
>> 2.6.18-92.1.10.el5.mk8 (gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)), uniq 
>> (GNU coreutils) vesion 5.97.
>>
>> Best regards, Alexander.
> 
> So the description in question is:
> 
> `-u'
> `--unique'
>      Discard the first repeated line.  When used by itself, this option
>      causes `uniq' to print unique lines, and nothing else.
> 
> Showing all combinations of options with the particular
> one in question at the end shows that we always discard
> later lines in a group.
> 
> $ cat in

1 a
2 a
3 a
1 b
2 b
1 c

> 
> $ for o in '' '-d' '-D' '-u' '-ud' '-dD' '-uD'; do echo "$=== $o ===="; 
> src/uniq $o -f1 in; done
> 1 a
> 2 a
> 3 a
> 1 b
> 2 b
> 1 c
> $===  ====
> 1 a
> 1 b
> 1 c
> $=== -d ====
> 1 a
> 1 b
> $=== -D ====
> 1 a
> 2 a
> 3 a
> 1 b
> 2 b
> $=== -u ====
> 1 c
> $=== -ud ====
> $=== -dD ====
> 1 a
> 2 a
> 3 a
> 1 b
> 2 b
> $=== -uD ====
> 1 a
> 2 a
> 1 b
> 
> 
> Now discarding a single item from a repeated group is unusual,
> whether one is discarding the first or the last.
> We should at least clarify the documentation, but please
> consider adjusting the sort(1) to select between these.
> I.E. for the above example: sort -r in -k2,2

Pushing the attached.

thanks,
Pádraig.

Attachment: uniq-uD-clarification.patch
Description: Text Data


reply via email to

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