让linux Sort 按照 ASCII 顺序排序

1.

#cat test.tmp

101.16.109.61 121230012020887483

101.16.109.6 130129103337518683 

101.16.109.62 121127113043951234

101.16.109.6 221103013246294953 

101.16.109.66 130307204231337635

101.16.109.67 121230012020887483

101.16.109.67 201212220213191952

2.

#sort test.tmp

101.16.109.61 121230012020887483 

101.16.109.6 130129103337518683 

101.16.109.62 121127113043951234 

101.16.109.6 221103013246294953 

101.16.109.66 130307204231337635 

101.16.109.67 121230012020887483 

101.16.109.67 201212220213191952 


3.

#LC_ALL=C; export LC_ALL

4.

#sort test.tmp

101.16.109.6 130129103337518683 

101.16.109.6 221103013246294953 

101.16.109.61 121230012020887483 

101.16.109.62 121127113043951234 

101.16.109.66 130307204231337635 

101.16.109.67 121230012020887483 

101.16.109.67 201212220213191952 


分析:

在2中的sort时,man sort中说“*** WARNING *** The locale specified by the environment affects sort order.”,所以在3中修改了LC_ALL并export,然后在4中sort就的到了预期的效果了



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值