原始文件的数据格式:(文件名:hotTagsWithNumber.txt)
http://www.wang1314.com/tag/3030.html,1152,学习
http://www.wang1314.com/tag/2064.html,398,名站
http://www.wang1314.com/tag/1420.html,447,工作
http://www.wang1314.com/tag/2903.html,278,下载
http://www.wang1314.com/tag/3394.html,55,知识
http://www.wang1314.com/tag/2979.html,212,新闻
http://www.wang1314.com/tag/2365.html,253,生活
http://www.wang1314.com/tag/956.html,373,博客
http://www.wang1314.com/tag/2741.html,106,网站
关于第二列求和:
awk -F ',' '{print $2}' hotTagsWithNumber.txt | sum
关于第二列排序:
awk -F ',' '{print $2, $0}' hotTagsWithNumber.txt | sort -n
http://www.wang1314.com/tag/3030.html,1152,学习
http://www.wang1314.com/tag/2064.html,398,名站
http://www.wang1314.com/tag/1420.html,447,工作
http://www.wang1314.com/tag/2903.html,278,下载
http://www.wang1314.com/tag/3394.html,55,知识
http://www.wang1314.com/tag/2979.html,212,新闻
http://www.wang1314.com/tag/2365.html,253,生活
http://www.wang1314.com/tag/956.html,373,博客
http://www.wang1314.com/tag/2741.html,106,网站
关于第二列求和:
awk -F ',' '{print $2}' hotTagsWithNumber.txt | sum
关于第二列排序:
awk -F ',' '{print $2, $0}' hotTagsWithNumber.txt | sort -n