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
替换
[root@test2 smartlsData]# ll | tr -d 'A'
总用量 390484
-rwxrwxrwx 1 root root 20580 12月 22 18:40 Code.ndx
-rwxrwxrwx 1 root root 338304 2006-08-10 nTable.txt
-rwxrwxrwx 1 root root 43680 2006-08-10 CnTable.txt
-rwxrwxrwx 1 root root 6664 9月 14 16:25 data.xml
-rwxrwxrwx 1 root root 194056 9月 15 16:31 GeoWordTableEntry.txt
-rwxrwxrwx 1 root root 4929920 9月 15 16:31 GeoWordTable.txt
-rwxrwxrwx 1 root root 9220800 12月 22 18:40 LsID.idx
-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 4929920 2006-08-29 wordTable.txt
[root@test2 smartlsData]# ll | cut -d " " -f 4root
root
root
root
root
root
root
root
root
root
root
root
拆分 按照大小 和 行 来拆分
split -b 1m detailWebsite.htm detailWebsite.htm_split -l 5 detailWebsite.htm detailWebsite.htm_