LunaVulpo
LunaVulpo

Reputation: 3211

how to sort file with hangul characters in linux?

I have file which contain many hangul characters. for example:

저
가
항
공
사

인
도
의
항
공
사

I want to use linux sort for sorting lines in file but sort doesn't work. It give me:

저
가
항
공
사
인
도
의
항
공
사

So, sort only sorts spaces. How to sort this?

Upvotes: 3

Views: 681

Answers (2)

Younggun Kim
Younggun Kim

Reputation: 986

You should be aware of another Korean locale, ko_KR.euckr.

Recently, It seems most of distro uses ko_KR.utf-8 as default Korean locale but ko_KR.euckr is still used widely.

Upvotes: 2

swpd
swpd

Reputation: 1151

This is related to the LANG environment variable of your system.

In order to sort hangul characters, LANG should be set to ko_KR.utf-8.

LANG=ko_KR.utf-8 sort tmp.txt

should suit your need:

가
공
공
도
사
사
의
인
저
항
항

:D

Upvotes: 8

Related Questions