不多说,直接上干货!
现有一份数据如下。
下载日志数据并分析
到搜狗实验室下载用户查询日志
1) 介绍
搜索引擎查询日志库设计为包括约1个月(2008年6月)Sogou搜索引擎部分网页查询需求及用户点击情况的网页查询日志数据集合。为进行中文搜索引擎用户行为分析的研究者提供基准研究语料。
2) 格式说明
数据格式为:访问时间\t用户ID\t[查询词]\t该URL在返回结果中的排名\t用户点击的顺序号\t用户点击的URL
其中,用户ID是根据用户使用浏览器访问搜索引擎时的Cookie信息自动赋值,即同一次使用浏览器输入的不同查询对应同一个用户ID。
前期博客
[[email protected] datas]$ cat weblog.log|tr "\t" "," > weblog2.log [[email protected] datas]$ more weblog2.log ?00:00:00,2982199073774412,[360安全卫士],8 3,download.it.com.cn/softweb/software/firewall/antivirus/20067/17938.html 00:00:00,07594220010824798,[哄抢救灾物资],1 1,news.21cn.com/social/daqian/2008/05/29/4777194_1.shtml 00:00:00,5228056822071097,[75810部队],14 5,www.greatoo.com/greatoo_cn/list.asp?link_id=276&title=%BE%DE%C2%D6%D0%C2%CE%C5 00:00:00,6140463203615646,[绳艺],62 36,www.jd-cd.com/jd_opus/xx/200607/706.html 00:00:00,8561366108033201,[汶川地震原因],3 2,www.big38.net/ 00:00:00,23908140386148713,[莫衷一是的意思],1 2,www.chinabaike.com/article/81/82/110/2007/2007020724490.html 00:00:00,1797943298449139,[星梦缘全集在线观看],8 5,www.6wei.net/dianshiju/????\xa1\xe9|????do=index 00:00:00,00717725924582846,[闪字吧],1 2,www.shanziba.com/ 00:00:00,41416219018952116,[霍震霆与朱玲玲照片],2 6,bbs.gouzai.cn/thread-698736.html 00:00:00,9975666857142764,[电脑创业],2 2,ks.cn.yahoo.com/question/1307120203719.html 00:00:00,21603374619077448,[111aa图片],1 6,www.fotolog.com.cn/tags/aa111 00:00:00,7423866288265172,[豆腐的制成],3 13,ks.cn.yahoo.com/question/1406051201894.html 00:00:00,0616877776407358,[tudou.com+禁播电影],2 9,topic.bindou.com/1487/ 00:00:00,3933365481995287,[最佳受孕时间],6 3,ks.cn.yahoo.com/question/1407051001276.html 00:00:00,8242389147671512,[捷克民歌土风舞++教案],2 3,shwamlys.blog.sohu.com/76558184.html 00:00:00,8248403977107859,[pdf],1 1,download.it168.com/18/1805/13947/13947_3.shtml 00:00:00,6239728533154822,[喷嘭乐团lonely+day],7 9,www.songtaste.com/song/266563/ 00:00:00,6551182914925117,[尼康相机报价],6 4,product.it168.com/list/b/03050171_1.shtml 00:00:00,2345161545038265,[哄抢救灾物资],2 1,pic.news.mop.com/gs/2008/0528/12985.shtml 00:00:00,06478452674857782,[1000],4 1,www.1000dy.cn/ 00:00:00,23405445793591878,[剑荡天下+++展鹏],4 5,74.53.27.3/~xx4ucom/bbs/simple/index.php?t31744.html 00:00:00,23457845712802688,[人妖],4 1,play.zol.com.cn/detail/1659_1.html 00:00:00,4625224675315291,[印尼排华是怎么回事],2 6,zhidao.baidu.com/question/47218514 00:00:00,048731119953599966,[东莞市塘厦新泰塑胶五金厂],10 44,www.hi-b2b.com/product/17w47204/index.shtml 00:00:00,48530765688455246,[胡其美],26 3,www.gotostreet.com/bbs/ShowPost.Asp?ID=121
将文件中的空格更换成逗号
cat weblog2.log|tr " " "," > weblog3.log
00:00:00,21603374619077448,[111aa图片],1 6,www.fotolog.com.cn/tags/aa111 00:00:00,7423866288265172,[豆腐的制成],3 13,ks.cn.yahoo.com/question/1406051201894.html 00:00:00,0616877776407358,[tudou.com+禁播电影],2 9,topic.bindou.com/1487/ 00:00:00,3933365481995287,[最佳受孕时间],6 3,ks.cn.yahoo.com/question/1407051001276.html 00:00:00,8242389147671512,[捷克民歌土风舞++教案],2 3,shwamlys.blog.sohu.com/76558184.html 00:00:00,8248403977107859,[pdf],1 1,download.it168.com/18/1805/13947/13947_3.shtml 00:00:00,6239728533154822,[喷嘭乐团lonely+day],7 9,www.songtaste.com/song/266563/ 00:00:00,6551182914925117,[尼康相机报价],6 4,product.it168.com/list/b/03050171_1.shtml 00:00:00,2345161545038265,[哄抢救灾物资],2 1,pic.news.mop.com/gs/2008/0528/12985.shtml 00:00:00,06478452674857782,[1000],4 1,www.1000dy.cn/ 00:00:00,23405445793591878,[剑荡天下+++展鹏],4 5,74.53.27.3/~xx4ucom/bbs/simple/index.php?t31744.html 00:00:00,23457845712802688,[人妖],4 1,play.zol.com.cn/detail/1659_1.html 00:00:00,4625224675315291,[印尼排华是怎么回事],2 6,zhidao.baidu.com/question/47218514 00:00:00,048731119953599966,[东莞市塘厦新泰塑胶五金厂],10 44,www.hi-b2b.com/product/17w47204/index.shtml 00:00:00,48530765688455246,[胡其美],26 3,www.gotostreet.com/bbs/ShowPost.Asp?ID=121 00:00:00,5750662932822584,[女士找鸭子经历],3 2,zhangxiaoyu52.blog.sohu.com/76119569.html 00:00:00,11515839301781111,[2008年运程],4 3,2008.gif123.com/ 00:00:00,26706283607513126,[芭蕾舞剧《天鹅湖》],5 6,you.video.sina.com.cn/b/5924814-1246200450.html 00:00:00,01532039495118448,[不锈钢],1 1,www.51bxg.com/ [[email protected]-pro01 datas]$ [[email protected]-pro01 datas]$ cat weblog2.log|tr " " "," > weblog3.log [[email protected]-pro01 datas]$ more weblog3.log 00:00:00,2982199073774412,[360安全卫士],8,3,download.it.com.cn/softweb/software/firewall/antivirus/20067/17938.html 00:00:00,07594220010824798,[哄抢救灾物资],1,1,news.21cn.com/social/daqian/2008/05/29/4777194_1.shtml 00:00:00,5228056822071097,[75810部队],14,5,www.greatoo.com/greatoo_cn/list.asp?link_id=276&title=%BE%DE%C2%D6%D0%C2%CE%C5 00:00:00,6140463203615646,[绳艺],62,36,www.jd-cd.com/jd_opus/xx/200607/706.html 00:00:00,8561366108033201,[汶川地震原因],3,2,www.big38.net/ 00:00:00,23908140386148713,[莫衷一是的意思],1,2,www.chinabaike.com/article/81/82/110/2007/2007020724490.html 00:00:00,1797943298449139,[星梦缘全集在线观看],8,5,www.6wei.net/dianshiju/????\xa1\xe9|????do=index 00:00:00,00717725924582846,[闪字吧],1,2,www.shanziba.com/ 00:00:00,41416219018952116,[霍震霆与朱玲玲照片],2,6,bbs.gouzai.cn/thread-698736.html 00:00:00,9975666857142764,[电脑创业],2,2,ks.cn.yahoo.com/question/1307120203719.html 00:00:00,21603374619077448,[111aa图片],1,6,www.fotolog.com.cn/tags/aa111 00:00:00,7423866288265172,[豆腐的制成],3,13,ks.cn.yahoo.com/question/1406051201894.html 00:00:00,0616877776407358,[tudou.com+禁播电影],2,9,topic.bindou.com/1487/ 00:00:00,3933365481995287,[最佳受孕时间],6,3,ks.cn.yahoo.com/question/1407051001276.html 00:00:00,8242389147671512,[捷克民歌土风舞++教案],2,3,shwamlys.blog.sohu.com/76558184.html
欢迎大家,加入我的微信公众号:大数据躺过的坑 免费给分享
同时,大家可以关注我的个人博客:
http://www.cnblogs.com/zlslch/ 和 http://www.cnblogs.com/lchzls/
详情请见:http://www.cnblogs.com/zlslch/p/7473861.html
人生苦短,我愿分享。本公众号将秉持活到老学到老学习无休止的交流分享开源精神,汇聚于互联网和个人学习工作的精华干货知识,一切来于互联网,反馈回互联网。
目前研究领域:大数据、机器学习、深度学习、人工智能、数据挖掘、数据分析。 语言涉及:Java、Scala、Python、Shell、Linux等 。同时还涉及平常所使用的手机、电脑和互联网上的使用技巧、问题和实用软件。 只要你一直关注和呆在群里,每天必须有收获
以及对应本平台的QQ群:161156071(大数据躺过的坑)
原文地址:https://www.cnblogs.com/zlslch/p/8215392.html