GNU排序命令的行为(带有非字母ASCII字符,如点或分号)

时间:2022-04-29 21:45:18

I want the sort command to treat all characters equal.

我想使用sort命令来处理所有相等的字符。

For example, when I do

例如,当我这样做

$ echo -e 'TEST.b\nTESTa\nTESTc' | sort
TESTa
TEST.b
TESTc

the dot is ignored.

点被忽略了。

I would like to get TEST.b at the last or first position. However, I cannot find the proper parameter in the manual page.

我想在最后或第一个位置获得TEST.b.但是,我在手册页中找不到合适的参数。

(my version of sort is from the GNU core utilities).

(我的排序版本来自GNU核心实用程序)。

1 个解决方案

#1


17  

Force collation to C in order to compare the raw character values.

强制整理到C以比较原始字符值。

$ echo -e 'TEST.b\nTESTa\nTESTc' | LC_COLLATE=C sort
TEST.b
TESTa
TESTc

#1


17  

Force collation to C in order to compare the raw character values.

强制整理到C以比较原始字符值。

$ echo -e 'TEST.b\nTESTa\nTESTc' | LC_COLLATE=C sort
TEST.b
TESTa
TESTc