Output from sort does not appear to be sorted

前端 未结 1 1135
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 22:09

I have the following text file (sort_test.txt):

PGA_scaffold1__77
PGA_scaffold2__36
PGA_scaffold3__111
PGA_scaffold4__129
PGA_scaffold5__109
PGA_scaffold6__104
P         


        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-25 22:55

    Thanks so much to @Barmar for pointing me to the Unix & Linux forum!

    I managed to indirectly find the answer to my problem in this post:

    Is gnu coreutils sort broken?

    The solution was to change my locale!

    My locale looked like this:

    $ 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=
    

    After running:

    $ export LC_COLLATE=C

    I was able to get my desired sorting output.

    0 讨论(0)
提交回复
热议问题