Linux sort 、 wc 的常用 技巧实例

Linux  sort的常用

按照第5个字段进行排序

[root@test2 smartlsData]# ll | sort -t : +5n
-rwxrwxrwx  1 root root 178718700 12月 22 18:40 Poi.bal
-rwxrwxrwx  1 root root 182348152 12月 22 18:40 Poi.bas
-rwxrwxrwx  1 root root  18441600 12月 22 18:40 Poi.ndx
-rwxrwxrwx  1 root root    194056 2006-08-29  wordTableEntry.txt
-rwxrwxrwx  1 root root    194056  9月 15 16:31 GeoWordTableEntry.txt
-rwxrwxrwx  1 root root     20580 12月 22 18:40 ACode.ndx
-rwxrwxrwx  1 root root    338304 2006-08-10  AnTable.txt
-rwxrwxrwx  1 root root     43680 2006-08-10  CnTable.txt
-rwxrwxrwx  1 root root   4929920 2006-08-29  wordTable.txt
-rwxrwxrwx  1 root root   4929920  9月 15 16:31 GeoWordTable.txt
-rwxrwxrwx  1 root root      6664  9月 14 16:25 data.xml
-rwxrwxrwx  1 root root   9220800 12月 22 18:40 LsID.idx 

按照纯数字进行排序(否则按照字母方式进行排序)

[root@test2 smartlsData]# ll | sort -n
-rwxrwxrwx  1 root root 178718700 12月 22 18:40 Poi.bal
-rwxrwxrwx  1 root root 182348152 12月 22 18:40 Poi.bas
-rwxrwxrwx  1 root root  18441600 12月 22 18:40 Poi.ndx
-rwxrwxrwx  1 root root    194056 2006-08-29  wordTableEntry.txt
-rwxrwxrwx  1 root root    194056  9月 15 16:31 GeoWordTableEntry.txt
-rwxrwxrwx  1 root root     20580 12月 22 18:40 ACode.ndx
-rwxrwxrwx  1 root root    338304 2006-08-10  AnTable.txt
-rwxrwxrwx  1 root root     43680 2006-08-10  CnTable.txt
-rwxrwxrwx  1 root root   4929920 2006-08-29  wordTable.txt
-rwxrwxrwx  1 root root   4929920  9月 15 16:31 GeoWordTable.txt
-rwxrwxrwx  1 root root      6664  9月 14 16:25 data.xml
-rwxrwxrwx  1 root root   9220800 12月 22 18:40 LsID.idx
总用量 390484

 

Linux  wc 的使用

wc -l  行号

wc -m

wc -w

[root@test2 smartlsData]# ll |wc -l
13

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值