GNU bug report logs -
#7407
about the order result of the sort command
Previous Next
Reported by: 黄东喜 <dongxi.huang <at> sinofriends.com>
Date: Mon, 15 Nov 2010 08:37:01 UTC
Severity: normal
Done: Pádraig Brady <P <at> draigBrady.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 7407 in the body.
You can then email your comments to 7407 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7407
; Package
coreutils
.
(Mon, 15 Nov 2010 08:37:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
黄东喜 <dongxi.huang <at> sinofriends.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 15 Nov 2010 08:37: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)]
[huangdongxi <at> localhost ~]$ echo "1001661 277
> 1001662 888
> 100166 73" | sort
1001661 277
1001662 888
100166 73
It should be
100166 73
1001661 277
1001662 888
It is different from the sort order of the “join” command.
Tel: 0755-86676269, 13510610982
Email:dongxi.huang <BLOCKED::mailto:.zeng <at> sinofriends.com> @sinofriends.com
珍爱公司中友集团旗下公司
Zhenai Inc.,a SinoFriends Inc. Company
网址: <BLOCKED::http://www.zhenai.com/> www.zhenai.com
地址:深圳市科技园北区朗山路11号同方信息港A座三楼
电话:0755-86296333邮编:518057
本邮件及其附件内容均属于中友集团公司保密信息,请收件人善尽保密之义务。
未经许可,请勿向任何无关的他人泄漏、转发、复制、散布、或允许使用本邮件信
息。如果您错收了本邮件,请即刻通知发件人,并删除本邮件。
[Message part 2 (text/html, inline)]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7407
; Package
coreutils
.
(Mon, 15 Nov 2010 16:19:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 7407 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 11/15/2010 01:17 AM, 黄东喜 wrote:
> [huangdongxi <at> localhost ~]$ echo "1001661 277
>
>> 1001662 888
>
>> 100166 73" | sort
>
> 1001661 277
>
> 1001662 888
>
> 100166 73
Thanks for the report. However, this is most likely not a bug in sort,
but in your expectations. This is a FAQ, and is probably due to your
locale:
http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021
Using the new 'sort --debug' feature of coreutils 8.7 shows:
$ echo "1001661 277
1001662 888
100166 73" | sort --debug
sort: using `en_US.UTF-8' sorting rules
1001661 277
___________
1001662 888
___________
100166 73
_________
$ echo "1001661 277
1001662 888
100166 73" | LC_ALL=C sort --debug
sort: using simple byte comparison
100166 73
_________
1001661 277
___________
1001662 888
___________
Remember, many non-C locales ignore whitespace in collation rules.
>
> It is different from the sort order of the “join” command.
Reread 'join --help':
> Important: FILE1 and FILE2 must be sorted on the join fields. E.g.,
> use ` sort -k 1b,1 ' if `join' has no options, or use ` join -t '' ' if
> `sort' has no options. Note, comparisons honor the rules specified by
> `LC_COLLATE'. If the input is not sorted and some lines cannot be
> joined, a warning message will be given.
If you correctly sorted with -k 1b,1 (or if you correctly used join -t
''), then you will get consistent results for your current locale
(whether or not you also choose to change things to require LC_ALL=C).
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Mon, 15 Nov 2010 16:49:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
黄东喜 <dongxi.huang <at> sinofriends.com>
:
bug acknowledged by developer.
(Mon, 15 Nov 2010 16:49:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 7407-done <at> debbugs.gnu.org (full text, mbox):
On 15/11/10 16:23, Eric Blake wrote:
> On 11/15/2010 01:17 AM, 黄东喜 wrote:
>>
>> It is different from the sort order of the “join” command.
>
> Reread 'join --help':
>
>> Important: FILE1 and FILE2 must be sorted on the join fields. E.g.,
>> use ` sort -k 1b,1 ' if `join' has no options, or use ` join -t '' ' if
>> `sort' has no options. Note, comparisons honor the rules specified by
>> `LC_COLLATE'. If the input is not sorted and some lines cannot be
>> joined, a warning message will be given.
>
> If you correctly sorted with -k 1b,1 (or if you correctly used join -t
> ''), then you will get consistent results for your current locale
> (whether or not you also choose to change things to require LC_ALL=C).
join -t '' is a recent addition, with join -t '\0' being the old way to achieve the same.
I'm marking this done as from the example the poster seems to want: sort -k 1b,1
cheers,
Pádraig.
Message #14 received at 7407-done <at> debbugs.gnu.org (full text, mbox):
Get it, thank you for your help. :)
-----邮件原件-----
发件人: Pádraig Brady [mailto:P <at> draigBrady.com]
发送时间: 2010年11月16日 0:53
收件人: Eric Blake
抄送: 黄东喜; 7407-done <at> debbugs.gnu.org
主题: Re: bug#7407: about the order result of the sort command
On 15/11/10 16:23, Eric Blake wrote:
> On 11/15/2010 01:17 AM, 黄东喜 wrote:
>>
>> It is different from the sort order of the “join” command.
>
> Reread 'join --help':
>
>> Important: FILE1 and FILE2 must be sorted on the join fields.
E.g.,
>> use ` sort -k 1b,1 ' if `join' has no options, or use ` join -t ''
' if
>> `sort' has no options. Note, comparisons honor the rules
specified by
>> `LC_COLLATE'. If the input is not sorted and some lines
cannot be
>> joined, a warning message will be given.
>
> If you correctly sorted with -k 1b,1 (or if you correctly used join -t
> ''), then you will get consistent results for your current locale
> (whether or not you also choose to change things to require LC_ALL=C).
join -t '' is a recent addition, with join -t '\0' being the old way to
achieve the same.
I'm marking this done as from the example the poster seems to want: sort -k
1b,1
cheers,
Pádraig.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 14 Dec 2010 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 193 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.