GNU bug report logs -
#23268
sort ant uniq bug report
Previous Next
Reported by: 126 <cool_navy <at> 126.com>
Date: Mon, 11 Apr 2016 15:32:01 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23268 in the body.
You can then email your comments to 23268 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#23268
; Package
coreutils
.
(Mon, 11 Apr 2016 15:32:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
126 <cool_navy <at> 126.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 11 Apr 2016 15:32:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
hello, Gentleman
when I use sort and uniq, and input like this below, I got wrong output:
$ echo "src/scenelayer/actSceneTipLayer.lua
> src/table/checkpoint/checkPointInfo5000.lua
> src/table/checkpoint/checkPointInfo5000.lua
> src/table/fightscenecheckpoint.lua
> src/scenelayer/actSceneTipLayer.lua
> src/table/checkpoint/checkPointInfo5000.lua
> src/table/checkpoint/checkPointInfo5000.lua
> src/table/fightscenecheckpoint.lua
> "|sort -u
src/scenelayer/actSceneTipLayer.lua
src/table/checkpoint/checkPointInfo5000.lua
src/table/checkpoint/checkPointInfo5000.lua
src/table/fightscenecheckpoint.lua
no result when I use `uniq -u`
$ echo "src/scenelayer/actSceneTipLayer.lua
src/table/checkpoint/checkPointInfo5000.lua
src/table/checkpoint/checkPointInfo5000.lua
src/table/fightscenecheckpoint.lua
src/scenelayer/actSceneTipLayer.lua
src/table/checkpoint/checkPointInfo5000.lua
src/table/checkpoint/checkPointInfo5000.lua
src/table/fightscenecheckpoint.lua
"|sort| uniq -u
It appear the same on CentOS, Cygwin , and Mac OS X
I wonder whether it's my own mistake or the program goes wrong.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#23268
; Package
coreutils
.
(Mon, 11 Apr 2016 15:53:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 23268 <at> debbugs.gnu.org (full text, mbox):
tag 23268 notabug
close 23268
thanks
Hello,
On 04/11/2016 06:49 AM, 126 wrote:
> hello, Gentleman
> when I use sort and uniq, and input like this below, I got wrong output:
[...]
>> "|sort -u
[...]
> no result when I use `uniq -u`
This is due to wrong usage of 'uniq -u'.
The meaning of '-u' in 'uniq' is subtly different than '-u' in 'sort':
In 'sort', it means "print each line once" i.e. removing duplicates.
In 'uniq', it means "print only unique lines" i.e. lines which appear only once.
The equivalent of 'sort -u' is 'sort|uniq'.
Since all lines in your input had duplicates, 'uniq -u' printed none.
The following will demonstrate:
$ printf "a\nb\na\nc\nb\n"
a
b
a
c
b
$ printf "a\nb\na\nc\nb\n" | sort -u
a
b
c
$ printf "a\nb\na\nc\nb\n" | sort | uniq
a
b
c
$ printf "a\nb\na\nc\nb\n" | sort | uniq -u
c
As such I'm closing this bug, but discussion can continue by replying to this thread.
regards,
- assaf
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#23268
; Package
coreutils
.
(Mon, 11 Apr 2016 17:57:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 23268 <at> debbugs.gnu.org (full text, mbox):
(adding debbugs mailing list)
Hello,
On 04/11/2016 12:43 PM, 126 wrote:
> Thank you for your reply.
> I'm sorry for not describe my problem clearly.
> Every other input is working well,but when my input contain several lines of "src/table/checkpoint/checkPointInfo5000.lua". The result of (sort -u) contain two lines of "src/table/checkpoint/checkPointInfo5000.lua"
Without seeing the exact input, it is hard to diagnose the issue.
Please attach a *small* input file, with the exact command that reproduces your situation to help us understand what's going on.
(I highly recommend attaching a file and not copy-pasting to avoid any issues caused by the mail program).
regards,
- assaf
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#23268
; Package
coreutils
.
(Sat, 27 Oct 2018 22:14:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 23268 <at> debbugs.gnu.org (full text, mbox):
tags 23268 notabug
close 23268
(triaging old bugs)
On 2016-04-11 11:56 a.m., Assaf Gordon wrote:
>
> On 04/11/2016 12:43 PM, 126 wrote:
>> Every other input is working well,but when my input contain several
>> lines of "src/table/checkpoint/checkPointInfo5000.lua". The result of
>> (sort -u) contain two lines of
>> "src/table/checkpoint/checkPointInfo5000.lua"
>
> Without seeing the exact input, it is hard to diagnose the issue.
>
> Please attach a *small* input file, with the exact command that
> reproduces your situation to help us understand what's going on.
With no further follow-ups in 2 years, I'm closing this bug.
-assaf
Added tag(s) notabug.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Oct 2018 22:14:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
23268 <at> debbugs.gnu.org and 126 <cool_navy <at> 126.com>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Oct 2018 22:14:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 25 Nov 2018 12:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 259 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.