[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 【已解决】求助批处理从一堆文本文件中提取关键词写到csv

本帖最后由 zhengwei007 于 2024-2-27 13:25 编辑

我想从100多个文档里面,发现有Soul Crystal字符时,截取<item>这段内容的字段。字段包括每个ID和count数量,单独存放在csv文件里。
文档中是以<item>开头,</item>结尾的,谢谢大家。
由于不能上传附件,我粘点里面内容吧。
  1. <item>
  2. <!-- Stormbringer -->
  3. <ingredient count="1" id="72" />
  4. <!-- Red Soul Crystal - Stage 5 -->
  5. <ingredient count="1" id="4634" />
  6. <!-- Gemstone C -->
  7. <ingredient count="97" id="2131" />
  8. <!-- Adena -->
  9. <ingredient count="291000" id="57" />
  10. <!-- Stormbringer - Critical Anger -->
  11. <production count="1" id="4681" />
  12. </item>
  13. <item>
  14. <!-- Guardian Sword - Great Gale -->
  15. <ingredient count="1" id="10955" />
  16. <!-- Adena -->
  17. <ingredient count="3390000" id="57" />
  18. <!-- Gemstone B -->
  19. <ingredient count="339" id="2132" />
  20. <!-- Blue Soul Crystal - Stage 10 -->
  21. <ingredient count="1" id="4661" />
  22. <!-- Guardian Sword - Great Gale - Critical Bleed -->
  23. <production count="1" id="10958" />
  24. </item>
  25. <item>
  26. <!-- Blood Brother - Great Gale -->
  27. <ingredient count="1" id="21966" />
  28. <!-- Blue Soul Crystal - Stage 14 -->
  29. <ingredient count="1" id="9571" />
  30. <!-- Gemstone S -->
  31. <ingredient count="285" id="2134" />
  32. <!-- Blood Brother - Great Gale - Light -->
  33. <production count="1" id="21969" />
  34. </item>
复制代码
每个文件里可能有多个这样的内容结构。
最终csv就是这样:
72        1        4634        1        2131        97        57        291000        4681        1
10955        1        57        3390000        2132        339        4661        1        10958        1
21966        1        9571        1        2134        285        21969        1               
谢谢各位大哥。

谢谢楼上几位,已经解决问题。

TOP

返回列表