1

I got a file with content like this:

----------- 
=========== 
-------- 
-=-=-=-=-=-

When I sort in a linux os, it comes like this:

$ sort 1.txt
=========== 
-=-=-=-=-=- 
-------- 
-----------

But when I sort in cygwin, it comes like this:

$ sort 1.txt 
-------- 
----------- 
-=-=-=-=-=- 
===========

I'm wondering why the result is not the same. I notice that the sort version in linux is 5.97, and in cygwin is 8.24. Or it's an encoding problem?

1
  • What is the result of hexdump 1.txt? Commented Feb 4, 2016 at 6:55

1 Answer 1

3

This is a locale issue, compare the output of locale in your two environments, and adjust the one where you want the output changed.

For example, on Linux (the sort version or OS shouldn't matter much):

$ LC_ALL=C sort t
--------
-----------
-=-=-=-=-=-
===========
$ LC_ALL=en_US.UTF-8 sort t
===========
-=-=-=-=-=-
--------
-----------
2
  • how to check the locale in two environments? Commented Feb 5, 2016 at 3:26
  • locale is a command, just type it. Commented Feb 5, 2016 at 5:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.