command: sort/uniq utf-8字符报错

By | 2014 年 11 月 20 日

sort cn_city.txt > qqq

sort: string comparison failed: Illegal byte sequence
sort: Set LC_ALL=’C’ to work around the problem.
sort: The strings compared were "CN","29","L\374xi"' and “CN”,”29″,”Baoshan”‘.

LC_ALL=POSIX sort cn_city.txt > cn_city_region.txt

uniq cn_city_region.txt > cn_city_region2.txt
uniq: cn_city_region.txt: Illegal byte sequence
LC_ALL=POSIX uniq cn_city_region.txt > cn_city_region2.txt

http://unix.stackexchange.com/questions/87745/what-does-lc-all-c-do

发表评论