Can sort be made to treat case as significant during sorting?
Having tried every possible command line option and tried various LC_ALL values, I cannot seem to enable this.
When sorting the following :
a
A
b
B
X
x
Z
z
the output obtained is :
a
A
b
B
x
X
z
Z
I would have thought a case sensitive sort should produce the following output :
A
B
X
Z
a
b
x
z
Does sort have an option to allow case sensitive sorting ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But the OP is saying that he/she gets the --ignore-case behaviour, even when this flag is not specified.
The actual locale involved isn't specified, but with "English_United Kingdom.1252", the sort command in my MSYS installation, (see www.mingw.org/MinGWiki/index.php/FAQ), behaves precisely as the OP expected.
Setting "LC_ALL", or any of the "LC_..." category variables, or "LANG", is a waste of time on Windoze, for Microsoft's [POSIXly broken] setlocale implementation doesn't respect the process environment settings, and worse still, doesn't respect ISO-639 language codes. (I'm currently developing a MinGW workaround for this).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can sort be made to treat case as significant during sorting?
Having tried every possible command line option and tried various LC_ALL values, I cannot seem to enable this.
When sorting the following :
a
A
b
B
X
x
Z
z
the output obtained is :
a
A
b
B
x
X
z
Z
I would have thought a case sensitive sort should produce the following output :
A
B
X
Z
a
b
x
z
Does sort have an option to allow case sensitive sorting ?
The -f (--ignore-case) option lets sort treat lowercase the same as uppercase. BTW, sort --help gives a summary of all options.
But the OP is saying that he/she gets the --ignore-case behaviour, even when this flag is not specified.
The actual locale involved isn't specified, but with "English_United Kingdom.1252", the sort command in my MSYS installation, (see www.mingw.org/MinGWiki/index.php/FAQ), behaves precisely as the OP expected.
Setting "LC_ALL", or any of the "LC_..." category variables, or "LANG", is a waste of time on Windoze, for Microsoft's [POSIXly broken] setlocale implementation doesn't respect the process environment settings, and worse still, doesn't respect ISO-639 language codes. (I'm currently developing a MinGW workaround for this).