Board logo

标题: [文本处理] [已解决]批处理如何提取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内容:
  1. <script>(function()
  2. {
  3. var _oTop = getTop(),
  4. _oCheckBoxes = _oTop.SN("AddrID", window),
  5. _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
  6. _oOuterLi = _oCkBox.parentNode.parentNode;
  7. while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
  8. {
  9. _oOuterLi = _oOuterLi.parentNode;
  10. }
  11. _oTop.listMouseEvent(_oOuterLi);
  12. _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
  13. QMReadedAddr.addItem(_oCkBox);
  14. })();</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&nbsp;</span><span class="c_l_mb" title="">&nbsp;</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()
  15. {
  16. var _oTop = getTop(),
  17. _oCheckBoxes = _oTop.SN("AddrID", window),
  18. _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
  19. _oOuterLi = _oCkBox.parentNode.parentNode;
  20. while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
  21. {
  22. _oOuterLi = _oOuterLi.parentNode;
  23. }
  24. _oTop.listMouseEvent(_oOuterLi);
  25. _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
  26. QMReadedAddr.addItem(_oCkBox);
  27. })();</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&nbsp;</span><span class="c_l_mb" title="">&nbsp;</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()
  28. {
  29. var _oTop = getTop(),
  30. _oCheckBoxes = _oTop.SN("AddrID", window),
  31. _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
  32. _oOuterLi = _oCkBox.parentNode.parentNode;
  33. while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
  34. {
  35. _oOuterLi = _oOuterLi.parentNode;
  36. }
  37. _oTop.listMouseEvent(_oOuterLi);
  38. _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
  39. QMReadedAddr.addItem(_oCkBox);
  40. })();</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&nbsp;</span><span class="c_l_mb" title="">&nbsp;</span><span class="c_l_l">&nbsp;</span><span class="c_l_s" title="" ></span></div></div><script>(function()
  41. {
  42. var _oTop = getTop(),
  43. _oCheckBoxes = _oTop.SN("AddrID", window),
  44. _oCkBox = _oCheckBoxes[_oCheckBoxes.length - 1],
  45. _oOuterLi = _oCkBox.parentNode.parentNode;
  46. while ( !_oTop.hasClass( _oOuterLi, "li_cnt") )
  47. {
  48. _oOuterLi = _oOuterLi.parentNode;
  49. }
  50. _oTop.listMouseEvent(_oOuterLi);
  51. _oTop.addEvent(_oOuterLi, "click", _oTop.GetListMouseClick(window));
  52. QMReadedAddr.addItem(_oCkBox);
  53. })();</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&nbsp;</span><span class="c_l_mb" title="">&nbsp;</span><span class="c_l_l">&nbsp;</span><span class="c_l_s" title="" ></span></div></div>
复制代码
把11.txt 中的@qq.com前面的QQ号提取出来!保存到另外一个词记事本中33.txt,一个号码一行!
作者: terse    时间: 2013-3-7 14:55

外部命令 sed 提取
  1. 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 编辑
  1. @echo off
  2. del _11.txt,33.txt
  3. for /f "tokens=18,19" %%a in ('findstr "@" 11.txt') do (
  4.     for /f "tokens=2,4,5 delims==>@ " %%i in ("%%a %%b") do echo %%~j
  5. )>>_11.txt
  6. for /f "delims=" %%i in (_11.txt) do (
  7. if not defined %%i set %%i=A & echo %%i|findstr "^[0-9]*$">>33.txt
  8. )
  9. 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个不通用的
再优化下  没测试
  1. @echo off
  2. (for /f "tokens=3-4 delims=@&" %%a in ('findstr /i ">[0-9]*@qq\.com&" 11.txt') do (
  3.     for /f "tokens=2 delims=>" %%i in ("%%a") do (
  4.         if not defined %%i echo %%i&set %%i=a
  5.     )
  6. ))>33.txt
  7. pause
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2