GNU bug report logs - #14555
Facing Some problem in uniq command

Previous Next

Package: coreutils;

Reported by: Shahid Hussain <shnx88 <at> gmail.com>

Date: Tue, 4 Jun 2013 16:21:02 UTC

Severity: normal

Tags: moreinfo

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at control <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Shahid Hussain <shnx88 <at> gmail.com>
Cc: GNU bug tracker automated control server <control <at> debbugs.gnu.org>,
	14555 <at> debbugs.gnu.org
Subject: Re: bug#14555: Facing Some problem in uniq command
Date: Tue, 04 Jun 2013 10:30:25 -0600
[Message part 1 (text/plain, inline)]
tag 14555 moreinfo
thanks

On 06/04/2013 06:07 AM, Shahid Hussain wrote:
> I have a file (named 'a')which contains following data.

> 9041
> 9042
> 8336
...

> 9041

Ouch.  Your file is not sorted.  Therefore, 9041 is NOT unique when run
through 'uniq', which only compares adjacent lines.

> And Below is the commands i am executing along with its output with
> comments.
> [ussc <at> lab211 config]$ uniq -d a
> 8336
> 8338

I get different results when copying and pasting from your email:
$ uniq -d a
8336
8338
9040
18000
$ uniq --version | head -n1
uniq (GNU coreutils) 8.17

Could it be you are using an older version of coreutils, and we have
fixed a bug in the meantime for how unique behaves when presented an
unsorted file?

>       1 18000
>       1 18000
> //Observe last line which is repeated with its previous line (some other
> entries are also there)but uniq command not able to find it.

One other possibility: Are you sure the whitespace is identical on every
line?  Or could you have trailing whitespace on one line but not the
other (such as a carriage return), so that the lines really are not
unique even though they appeared unique?  If so, that would explain why
_my_ uniq run counted 18000 as a duplicate, if the act of sending the
email and then me copying and pasting into a file munged the whitespace
differences away.

While I suspect that there is no bug in coreutils, I need more
information from you to confirm that claim, so I'm leaving the bug open
for now.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 6 years and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.