Spaces are being ignored when sorting data

  • 3006646
  • 29-Aug-2006
  • 30-Apr-2012


All Novell Linux products

A locale collation setting otherthan 'C' or 'POSIX' is being used.


When sorting data, e.g. through the sort command or the qsort library function, spaces are being ignored. For example, in an ascending sort, "den haag" is being put before "de vries".


As a workaround, convert space characters into non-breaking space characters prior to sorting and perform the reverse substitution after sorting.

For example, to sort a filemylistand treat spaces as significant for sorting, do
perl -C -pe "s/ /\xa0/g;"< mylist | sort | perl -C -pe "s/\xa0/ /g;"> mylist.sorted

Change Log

2010-04-06 - Franz Hassels - Removed "Reported to Engineering" as requested by Cheryl King