Bug 151959 - ls | sort gives wrong order
Summary: ls | sort gives wrong order
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: coreutils (Show other bugs)
(Show other bugs)
Version: 4.0
Hardware: i386 Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-23 20:49 UTC by joseph
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-24 11:21:36 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description joseph 2005-03-23 20:49:13 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308

Description of problem:
when I use ls and sort commnd, It does not give the correct order. e.g. I have directory called temp, under temp, I created the following files:
Avoid  BolusPTV  CTV_CT  GTV_CT  markers  PTV_CT  skin. I use the touch command. then I issue the command ls | sort, it give me the results as "Avoid  BolusPTV  CTV_CT  GTV_CT  markers  PTV_CT  skin". The "markers" shall be after the "PTV_CT". This is a error or a bug

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.mkdir temp
2. touch Avoid  BolusPTV  CTV_CT  GTV_CT  markers  PTV_CT  skin
3. ls | sort
  

Actual Results:  Avoid  BolusPTV  CTV_CT  GTV_CT  markers  PTV_CT  skin

Expected Results:  Avoid  BolusPTV  CTV_CT  GTV_CT PTV_CT  markers skin

Additional info:

Comment 1 Tim Waugh 2005-03-24 11:21:36 UTC
You don't say what locale you are using, but presumably it is not the C locale
(which *would* give the order you cite).

To get the order you want, use:

ls | LC_COLLATE=C sort

ISO 14651, which is the sorting standard, specifies this behaviour.  You can
also find some information in the strcoll documentation.

IEEE Std 1003.1, 2003 Edition, says that the sorting "shall be performed
using the collating sequence of the current locale".


Note You need to log in before you can comment on or make changes to this bug.