4.处理一下文件内容,将域名取出并进行计数排数,如处理:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

http://www.baidu.com/index.html

http://ww.baidu.com/1.html

http://www.baidu.com/2.html

http://post.baidu.com/index.html

http://mp3.baidu.com/index.html

http://www.baidu.com/3.html

http://post.baidu.com/2.html

得到如下结果:域名的出现次数,域名

4     www.baidu.com

2     post.baidu.com

1     mp3.baidu.com

shell程序如下:

方法一: #cat file|sed -e 's/http:\/\///' -e 's/\/.*//'|sort|uniq -c|sort -nr|head -10

方法二: #awk -F/  '{print $3}' file|sort -r|uniq -c|awk '{print $1 "\t",$2}'