RedHat's sort command is not sorting by character value.

Technical Q&A involving operating systems, networking, software, and hardware issues.

Moderator: jasonb

Post Reply
User avatar
jasonb
Site Administrator
Posts: 105
Joined: Tue Apr 22, 2003 1:54 pm
Location: Toronto, Canada
Contact:

RedHat's sort command is not sorting by character value.

Post by jasonb »

The default sort order that RedHat uses changed in 7.x and later versions. The difference is shown as follows.

Old:

a b
a c
ab
ac

New:

a b
ab
a c
ac

In the new sorting order, the spaces are not treated like other alphanumeric characters, but are "secondary".

This is because the sort order was changed from "C" to "en_US". To get the old style of sorting back, simply set the environment variable "LC_ALL" to "C".
Post Reply