linux 中 sort -h选项

 

-h:使用易读性数字,比如 K, G单位。

 

001、

[root@PC1 test02]# ls
a.txt
[root@PC1 test02]# cat a.txt        ## 测试数据
2G
3K
4K
1G
[root@PC1 test02]# sort a.txt
1G
2G
3K
4K
[root@PC1 test02]# sort -n a.txt
1G
2G
3K
4K
[root@PC1 test02]# sort -h a.txt     ## 按照易读性数字排序
3K
4K
1G
2G

 。

 

posted @ 2023-07-25 16:19  小鲨鱼2018  阅读(105)  评论(0编辑  收藏  举报