-
sort排序 - [tips]2009-03-30
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://opendream.blogbus.com/logs/37231779.html
Sort:
#man sort
........
-n, --numeric-sort
compare according to string numerical value-k, --key=POS1[,POS2]
start a key at POS1, end it at POS2 (origin 1)-t, --field-separator=SEP
use SEP instead of non-blank to blank transition-r, --reverse
reverse the result of comparisons........
Example:#cat test.txt
pengyao:3:good
test:6:greate
Peng.Yao:10:test
1.以":"为分隔符排序
#sort -t ":" test.txt
2.对数字进行排序
#sort -t ":" -k 2 -n test.txt
3.对数字以大到小(逆向)进行排序
#sort -t ":" -k 2 -n -r test.txt
收藏到:Del.icio.us








评论