标题: [文本处理] [已解决]批处理如何提取qq邮箱帐号中的qq号? [打印本页]
作者: 920168 时间: 2013-3-7 14:30 标题: [已解决]批处理如何提取qq邮箱帐号中的qq号?
本帖最后由 pcl_test 于 2017-4-30 22:51 编辑
RT:
需提取的11.txt,内容有很多,只是列举一些!
把11.txt 中的@qq.com前面的QQ号提取出来!保存到另外一个词记事本中33.txt,一个号码一行!去掉重复号码,和非数字号码!
11.txt内容:- <script>(function()
- {
- var _oTop = getTop(),
- _oCheckBoxes = _oTop.SN("AddrID", window),
- _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
- _oOuterLi = _oCkBox.parentNode.parentNode;
- while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
- {
- _oOuterLi = _oOuterLi.parentNode;
- }
- _oTop.listMouseEvent(_oOuterLi);
- _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
- QMReadedAddr.addItem(_oCkBox);
- })();</script></div><div class="li_cnt" id="Addrline_221"><div id="InGroupCon" style="display:none"></div><div class="li_cnt_a"><label class="c_checkbox_p"><input type="checkbox" class="c_checkbox c_cb_list" id="221" name="AddrID" value="221" /></label><div class="c_l_box cf" onclick="showAddrDetail(this,event)" n="车之盾--设计" m="1063963245@qq.com"><input type="hidden" value="AddrID:221|category:all|view:normal|grpid:|isqqgroup:"><span class="c_l_n" title="车之盾--设计"><span class="c_name">车之盾--设计</span></span><span class="c_l_e" title="1063963245@qq.com">1063963245@qq.com </span><span class="c_l_mb" title=""> </span><span class="c_l_l"><span title="等级: 7" class="level_image level_2 c_level"></span></span><span class="c_l_s" title="" ></span></div></div><script>(function()
- {
- var _oTop = getTop(),
- _oCheckBoxes = _oTop.SN("AddrID", window),
- _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
- _oOuterLi = _oCkBox.parentNode.parentNode;
- while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
- {
- _oOuterLi = _oOuterLi.parentNode;
- }
- _oTop.listMouseEvent(_oOuterLi);
- _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
- QMReadedAddr.addItem(_oCkBox);
- })();</script></div><div class="li_cnt" id="Addrline_277"><div id="InGroupCon" style="display:none"></div><div class="li_cnt_a"><label class="c_checkbox_p"><input type="checkbox" class="c_checkbox c_cb_list" id="277" name="AddrID" value="277" /></label><div class="c_l_box cf" onclick="showAddrDetail(this,event)" n="▄D調。寳児" m="709394931@qq.com"><input type="hidden" value="AddrID:277|category:all|view:normal|grpid:|isqqgroup:"><span class="c_l_n" title="▄D調。寳児"><span class="c_name">▄D調。寳児</span></span><span class="c_l_e" title="709394931@qq.com">709394931@qq.com </span><span class="c_l_mb" title=""> </span><span class="c_l_l"><span title="等级: 8" class="level_image level_3 c_level"></span></span><span class="c_l_s" title="" ></span></div></div><script>(function()
- {
- var _oTop = getTop(),
- _oCheckBoxes = _oTop.SN("AddrID", window),
- _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
- _oOuterLi = _oCkBox.parentNode.parentNode;
- while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
- {
- _oOuterLi = _oOuterLi.parentNode;
- }
- _oTop.listMouseEvent(_oOuterLi);
- _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
- QMReadedAddr.addItem(_oCkBox);
- })();</script></div><div class="li_cnt" id="Addrline_270"><div id="InGroupCon" style="display:none"></div><div class="li_cnt_a"><label class="c_checkbox_p"><input type="checkbox" class="c_checkbox c_cb_list" id="270" name="AddrID" value="270" /></label><div class="c_l_box cf" onclick="showAddrDetail(this,event)" n="刁蛹支" m="dongqiangzeng52@163.com"><input type="hidden" value="AddrID:270|category:all|view:normal|grpid:|isqqgroup:"><span class="c_l_n" title="刁蛹支"><span class="c_name">刁蛹支</span></span><span class="c_l_e" title="dongqiangzeng52@163.com">dongqiangzeng52@163.com </span><span class="c_l_mb" title=""> </span><span class="c_l_l"> </span><span class="c_l_s" title="" ></span></div></div><script>(function()
- {
- var _oTop = getTop(),
- _oCheckBoxes = _oTop.SN("AddrID", window),
- _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
- _oOuterLi = _oCkBox.parentNode.parentNode;
- while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
- {
- _oOuterLi = _oOuterLi.parentNode;
- }
- _oTop.listMouseEvent(_oOuterLi);
- _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
- QMReadedAddr.addItem(_oCkBox);
- })();</script></div><div class="li_cnt" id="Addrline_282"><div id="InGroupCon" style="display:none"></div><div class="li_cnt_a"><label class="c_checkbox_p"><input type="checkbox" class="c_checkbox c_cb_list" id="282" name="AddrID" value="282" /></label><div class="c_l_box cf" onclick="showAddrDetail(this,event)" n="erp" m="erp@ustar.cn"><input type="hidden" value="AddrID:282|category:all|view:normal|grpid:|isqqgroup:"><span class="c_l_n" title="erp"><span class="c_name">erp</span></span><span class="c_l_e" title="erp@ustar.cn">erp@ustar.cn </span><span class="c_l_mb" title=""> </span><span class="c_l_l"> </span><span class="c_l_s" title="" ></span></div></div>
复制代码
把11.txt 中的@qq.com前面的QQ号提取出来!保存到另外一个词记事本中33.txt,一个号码一行!
作者: terse 时间: 2013-3-7 14:55
外部命令 sed 提取- sed -r -n "/@qq\.com/s/.*>([0-9]*)@qq\.com.*/\1/p" 11.txt>33.txt
复制代码
作者: 920168 时间: 2013-3-7 15:24
回复 2# terse
3Q 非常感谢!!
作者: cjiabing 时间: 2013-3-7 15:31
本帖最后由 cjiabing 于 2013-3-7 15:44 编辑
- @echo off
- del _11.txt,33.txt
- for /f "tokens=18,19" %%a in ('findstr "@" 11.txt') do (
- for /f "tokens=2,4,5 delims==>@ " %%i in ("%%a %%b") do echo %%~j
- )>>_11.txt
- for /f "delims=" %%i in (_11.txt) do (
- if not defined %%i set %%i=A & echo %%i|findstr "^[0-9]*$">>33.txt
- )
- del _11.txt&start "" 33.txt
复制代码
作者: 920168 时间: 2013-3-7 15:43
回复 4# cjiabing
这个技术更高!!!
作者: cjiabing 时间: 2013-3-7 15:45
回复 5# 920168
很简单的,修改了下更符合你题意。
作者: terse 时间: 2013-3-7 18:09
本帖最后由 terse 于 2013-3-7 18:25 编辑
也来p个不通用的
再优化下 没测试- @echo off
- (for /f "tokens=3-4 delims=@&" %%a in ('findstr /i ">[0-9]*@qq\.com&" 11.txt') do (
- for /f "tokens=2 delims=>" %%i in ("%%a") do (
- if not defined %%i echo %%i&set %%i=a
- )
- ))>33.txt
- pause
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |