GNU bug report logs -
#11900
Sort by month fails if not in first field or first position
Previous Next
Reported by: jim <at> smartots.com
Date: Tue, 10 Jul 2012 16:07:02 UTC
Severity: normal
Tags: notabug
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 11900 in the body.
You can then email your comments to 11900 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#11900
; Package
coreutils
.
(Tue, 10 Jul 2012 16:07:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
jim <at> smartots.com
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 10 Jul 2012 16:07:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
If I put a month in any column other than the first, at any position than the first, sort fails-
> echo -e "1 qFeb\n1 qJan" | sort -k2.2,2.5M
1 qFeb
1 qJan
The following all *DO* work, however:
#First column, not first position
> echo -e "qFeb\nqJan" | sort -k1.2,1.5M
qJan
qFeb
#Second column, first position
> echo -e "1 Feb\n1 Jan" | sort -k2.1,2.4M
1 Jan
1 Feb
#Second column, full key
> echo -e "1 Feb\n1 Jan" | sort -k2M
1 Jan
1 Feb
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#11900
; Package
coreutils
.
(Tue, 10 Jul 2012 17:17:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 11900 <at> debbugs.gnu.org (full text, mbox):
tag 11900 + notabug
close 11900
stop
On 07/10/2012 08:42 AM, jim <at> smartots.com wrote:
> echo -e "1 qFeb\n1 qJan" | sort -k2.2,2.5M
Yep that's a tricky one, but specified by POSIX.
--debug is very useful here...
$ echo -e "1 qFeb\n1 qJan" | sort --debug -k2.2,2.5M
sort: using ‘en_US.utf8’ sorting rules
sort: leading blanks are significant in key 1; consider also specifying 'b'
1 qFeb
^ no match for key
______
1 qJan
^ no match for key
______
Now you might think you can just specify -b, but...
$ echo -e "1 qFeb\n1 qJan" | sort --debug -b -k2.2,2.5M
sort: using ‘en_US.utf8’ sorting rules
sort: leading blanks are significant in key 1; consider also specifying 'b'
sort: option '-b' is ignored
1 qFeb
^ no match for key
______
1 qJan
^ no match for key
______
So you might then think you could add 'b' to the full key, but...
$ echo -e "1 qFeb\n1 qJan" | sort --debug -b -k2.2,2.5Mb
sort: using ‘en_US.utf8’ sorting rules
sort: leading blanks are significant in key 1; consider also specifying 'b'
1 qFeb
^ no match for key
______
1 qJan
^ no match for key
______
So what you really need to do is:
$ echo -e "1 qFeb\n1 qJan" | sort --debug -k2.2b,2.5Mb
sort: using ‘en_US.utf8’ sorting rules
1 qJan
___
______
1 qFeb
___
______
cheers,
Pádraig.
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Tue, 10 Jul 2012 17:17:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
11900 <at> debbugs.gnu.org and jim <at> smartots.com
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Tue, 10 Jul 2012 17:17:02 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
.
(Wed, 08 Aug 2012 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 318 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.