0

I have got strange result of sort on Linux

$ uname -a
Linux ... 2.6.32-279.5.2.el6.x86_64 #1 SMP Tue Aug 14 11:36:39 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

$ sort --version
sort (GNU coreutils) 8.4

Here is file zzz2.

   pe/CCC 
   pe_ext/CCC 
   pe/MMM 

$ sort zzz2

   pe/CCC 
   pe_ext/CCC 
   pe/MMM 


Exppected output:
   pe/CCC 
   pe/MMM 
   pe_ext/CCC 



Appendix.

$ od -c zzz2
0000000   p   e   /   C   C   C  \r  \n   p   e   _   e   x   t   /   C
0000020   C   C  \r  \n   p   e   /   M   M   M
0000032

3
  • Got any weird unprintable characters at the start of any of the lines? Commented Sep 16, 2013 at 10:33
  • Same behaviour happens to me. Linux 3.8.0-29-generic, sort (GNU coreutils) 8.20 Commented Sep 16, 2013 at 10:34
  • I have added output of od -c zzz2 Commented Sep 16, 2013 at 10:39

1 Answer 1

1

try to use another locale like

LC_ALL=C sort filename

see: https://superuser.com/a/226489

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.