想像する:
# on Linux
$ cat r456.txt
e+e+l
e+e-c
$ cat r456.txt | sort
e+e-c
e+e+l
$ sort --version
sort (GNU coreutils) 8.30
# on Cygwin
$ cat r456.txt
e+e+l
e+e-c
$ cat r456.txt | sort
e+e+l
e+e-c
$ sort --version
sort (GNU coreutils) 9.0
Packaged by Cygwin (9.0-1)
ここではsort
、LinuxとCygwinで異なる結果が返されることがわかります。なぜ?
sort
LinuxとCygwinで同じ結果を返す方法は?
UPD。地域設定:
# on Linux
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
# on Cygwin
$ locale
LANG=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=
UPD2。 Cygwinのすべてのロケールをen_US.UTF-8
。sort
# on Linux
$ cat r456a.txt
u1
u-1
$ cat r456a.txt | sort
u-1
u1
# on Cygwin
$ cat r456a.txt
u1
u-1
$ cat r456a.txt | sort
u1
u-1
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=en_US.UTF-8
どうすれば修正できますか?