1、先将QQ群的消息记录以.txt文件格式导出来,保存路径及名称自己定义(在本文我导出到Y盘,命名为test.txt)

2、程序如下:

data statistics1;
if _n_=1 then do;
patternid1=prxparse("/\s\w*-*\w*-*\w*\(\d+\)/");
patternid2=prxparse("/\(\d+\)/");
end;
retain patternid1 patternid2;
infile 'Y:\test.txt' truncover;
input string $200.;
length name $50. qq $30.;
call prxsubstr(patternid1,string,start1,length1);
call prxsubstr(patternid2,string,start2,length2);
if start1 and start2 gt 0 then do;
name=substrn(string,start1+1,length1-1);
qq=substrn(string,start2+1,length2-2);
output;
end;
run; data statistics2;
if _n_=1 then do;
patternid1=prxparse("/\s\w*-*\w*-*\w*<(\w*|\d*)@(\w*|\d*).\w+>/");
patternid2=prxparse("/<(\w*|\d*)@(\w*|\d*).\w+>/");
end;
retain patternid1 patternid2;
infile 'Y:\test.txt' truncover;
input string $200.;
length name $50. qq $30.;
call prxsubstr(patternid1,string,start1,length1);
call prxsubstr(patternid2,string,start2,length2);
if start1 and start2 gt 0 then do;
name=substrn(string,start1+1,length1-1);
qq=substrn(string,start2+1,length2-2);
output;
end;
run; data qunname;
infile 'Y:\test.txt' truncover firstobs=6 obs=6;
input @'消息对象:' qunname $;
call symput('_qunname',qunname);
run; data statistics(drop=patternid1 patternid2 string start1 start2 length1 length2);
set statistics1 statistics2;
where qq^='';
n=_n_;
run; proc sort data=statistics;by qq n;run; data match;
set statistics;
by qq n;
if last.qq then output;
drop n;
run; data _null_;
set statistics nobs=t;
call symput("_nobs",t);
stop;
run; proc sql;
create table rtf as
select qq,n(qq) as frequency,n(qq)/&_nobs.*100 as rate
from statistics
group by qq
order by 1;
quit; data rtf;
merge rtf match;
by qq;
run; proc sort data=rtf;by descending frequency;run; options nodate nonumber;
ods results=off;
title;
footnote;
ods listing close;
ods rtf file='Y:\statistics.rtf' style=Mystyles bodytitle;
proc report data=rtf nowindows style(report)={font_size=10.5pt pretext="QQ群(&_qunname.)成员发言次数及频率统计分析表" posttext="Author:liyongzhao,Created Date:2013-9-12." just=left}
style(column)={font=('times new roman',12pt)};
column name frequency rate;
define name/center style(column)={cellwidth=15%} 'QQ群成员';
define frequency/center style(column)={cellwidth=5%} '发言次数';
define rate/center style(column)={cellwidth=5%} format=6.3 '发言频率(%)';
run;
ods rtf close;

3、打开Statistics.rtf即可查看结果。

结果类似下图(截取开头部分,隐去QQ群名称和个人QQ号码):

QQ群成员发言次数统计(正则表达式版)的更多相关文章

  1. QQ群成员发言次数统计(词云制作)

    所用数据来自于之前的一篇博客: <QQ群成员发言次数统计(正则表达式版)> 链接:http://www.cnblogs.com/liyongzhao/p/3324026.html 1.首先 ...

  2. 利用Python获取统计自己的qq群成员信息

    利用python获取自己的qq群成员信息! 首先说明一下需要使用的工具以及技术:python3 + selenium selenium安装方法:pip install selenium 前提:获取自己 ...

  3. 9 行 javascript 代码获取 QQ 群成员

    昨天看到一条微博:「22 行 JavaScript 代码实现 QQ 群成员提取器」. 本着好奇心点击进去,发现没有达到效果,一是 QQ 版本升级了,二是博客里面的代码也有些繁琐. 于是自己试着写了一个 ...

  4. 精准营销、批量提取QQ群成员号码

    有时我们在做精准营销时,需要从社群里提取群成员的QQ号,群发邮件,常规的做法是手工一个个复制粘贴,这样的效率无疑是很低的,下面我来分享一个批量获取社群的QQ号方法. 需要具备以下工具: 1.大量精准Q ...

  5. 利用python获取自己的qq群成员信息

    利用python获取自己的qq群成员信息! 首先说明一下需要使用的工具以及技术:python3 + selenium selenium安装方法:pip install selenium 前提:获取自己 ...

  6. 火车头采集器如何采集QQ群成员中的QQ号

    如何采集QQ群群员QQ号,采集QQ号,批量采集QQ号 众所周知,QQ群群员QQ号无法导出,即使会员也不可以,那我们只能通过三方工具来实现我们的要求,那今天我们讲讲如何通过火车采集器来采集QQ群群员QQ ...

  7. 关于一键提取QQ群成员信息的记录

    问题情境 昨天晚上回宿舍看到舍友在吐槽:天哪,我要把70多个人的QQ号全统计出来,只能一个一个地在咱们学院的学院群里找.吐了. 当时我第一反应是用python写个脚本之类的去做,因此查阅了一下资料,找 ...

  8. 如何采集所有QQ群成员?

    首先,你需要有一个CHROME浏览器其实,你要装一个叫REGEX SCRAPER的插件 在qun.qzone.qq.com打开你的QQ群页面-查看群成员 点击REGEX 插件, 粘贴上这个代码 tex ...

  9. (获取qq群成员信息,并下载头像,每个群保存一个文件夹)

    # 1.获取到自己qq里面所有的群,并且保存每个群里面的群成员信息到mongodb里面# 下载每个群的群成员的头像# 1.抓包,抓到获取自己所有qq群的接口 requests模块 https://qu ...

随机推荐

  1. Practical Node.js (2018版) 第8章:Building Node.js REST API Servers

    Building Node.js REST API Servers with Express.js and Hapi Modern-day web developers use an architec ...

  2. 【PAT】我要通过!

    “答案正确”是自动判题系统给出的最令人欢喜的回复.本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”. 得到“答案正确”的条件是: 1 ...

  3. Python3+pyshark捕获数据包并保存为文件

    一.直接使用wireshark捕获数据包并保存为文件 可以使用wireshark通过图形界面的操作来实现捕获数据包并保存为文件. wireshark默认捕获的数据包保存为临时文件,如果最后退出时不选择 ...

  4. CCF关于公开NOIP复赛选手程序的通告

    为使参加NOIP复赛的选手能了解和保存其竞赛时编制的程序,并相互监督,CCF责成各省特派员在复赛后公开选手程序. 公布方式:以提高组和普及组分别为单位,通过网站或邮件等方式公开.以每个选手可以看到本省 ...

  5. Python *Mix_w

    Python的历史起源: 1989年圣诞节期间,由吉多.范罗苏姆创始. Python的优点"优美""明确""简单" python是一门解释型 ...

  6. LL(1),LR(0),SLR(1),LR(1),LALR(1)的 联系与区别

    一:LR(0),SLR(1),规范LR(1),LALR(1)的关系     首先LL(1)分析法是自上而下的分析法.LR(0),LR(1),SLR(1),LALR(1)是自下而上的分析法.       ...

  7. elastic search 常用查询

    1.查询mapping curl -X GET "10.0.38.111:1200/metric_data_bus_2018-08-07/_mapping/data_bus?pretty&q ...

  8. [Leetcode 771]宝石和石子 Jewels and Stones HashSet简单应用

    [题目] You're given strings J representing the types of stones that are jewels, and S representing the ...

  9. os、os.path模块(文件/目录方法)

    1.模块的概念:模块是一个包含所有定义的变量.函数的文件,模块可以被其余模块调用. 2.利用OS模块实现对系统文件的. os模块中常见的方法: gercwd()     返回当前工作目录 chdir( ...

  10. java中main函数的String[] args

    写java程序时main函数必须有一个字符串数组即String[] args 作用:用来获取用户从命令行输入的参数 如果main函数中不写字符串数组,则将会报错