Red Hat Bugzilla – Bug 428679
Sort behaves as if the -b and -d options are always set
Last modified: 2008-01-14 12:52:25 EST
Description of problem:
Sort is set up to behave as if the -b and -d options are always set, namely
a blank or a special character are in column one of a specified field, then
sort looks ahead for the first alphanumeric character and uses that to begin
the key. This is not in accordance with the man pages, and I need to be
able to sort on the field I specified for my programs to work correctly.
How do I unseclect this behavior? Specifically, I want column one of each
field to be
ordered all on it's own, and only then to look at column two, unless I ask
for -b or -d.
Version-Release number of selected component (if applicable):
All versions from Fedora 6 to 8
Steps to Reproduce:
So far the only workaround I found is to sort each column as a separate
field such as -k 1.1,1.1 -k 1.2,1.2 etc
As written in man pages:
*** WARNING *** The locale specified by the environment affects sort
order. Set LC_ALL=C to get the traditional sort order that uses native
You are using en_US locale, which gives you output as is in actual results.
With LC_ALL=C you will get:
- sorted by common ASCII table and no leading space skipped. So sorry, but
NOTABUG for me - expected behaviour for that locale. So your problem has nothing
to do with -b and -d always set, but more with locales (I checked the sourcecode
quickly and -b -d are not always set in sort.c code). Feel free to reopen it if
I missed something. You could ask about that behaviour in upstream mailing list
if you really think that this behaviour is buggy(email@example.com).