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
本文介绍了Linux系统中sort命令的使用方法,包括按特定字段排序及按纯数字排序等技巧,并展示了wc命令用于统计文件内容的基本用法,如计数行数、字符数和单词数。
811

被折叠的 条评论
为什么被折叠?



