Description of problem: Sort is set up to behave as if the -b and -d options are always set, namely that if 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 How reproducible: Always Steps to Reproduce: 1. 2. 3. Actual results: a a a _a A aa Z _Z Expected results: a a _a _Z a aa A Z Additional info: 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 byte values. You are using en_US locale, which gives you output as is in actual results. With LC_ALL=C you will get: a a A Z _Z _a a aa - 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(bug-coreutils).