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

[文本处理] 【已解决】求助BAT代码中提取几个关键词写到csv中

一共有2组,第一组代码如下:
  1. <item npcId="20583"> <!-- Timak Orc -->
  2. <detail chance="9" skill="true" maxLevel="1" />
  3. </item>
  4. <item npcId="20584"> <!-- Timak Orc Archer -->
  5. <detail chance="9" skill="true" maxLevel="1" />
  6. </item>
  7. <item npcId="20585"> <!-- Timak Orc Soldier -->
  8. <detail chance="9" skill="true" maxLevel="1" />
  9. </item>
  10. <item npcId="20586"> <!-- Timak Orc Warrior -->
  11. <detail chance="9" skill="true" maxLevel="1" />
  12. </item>
  13. <item npcId="20587"> <!-- Timak Orc Shaman -->
  14. <detail chance="9" skill="true" maxLevel="2" />
  15. </item>
  16. <item npcId="20588"> <!-- Timak Orc Overlord -->
  17. <detail chance="9" skill="true" maxLevel="2" />
  18. </item>
  19. <item npcId="20625"> <!-- Malruk Knight -->
  20. <detail chance="9" skill="true" maxLevel="9" />
  21. </item>
  22. <item npcId="20626"> <!-- Malruk Berserker -->
  23. <detail chance="9" skill="true" maxLevel="9" />
  24. </item>
  25. <item npcId="20627"> <!-- Malruk Lord -->
  26. <detail chance="9" skill="true" maxLevel="9" />
  27. </item>
  28. <item npcId="20628"> <!-- Limal Karinness -->
  29. <detail chance="9" skill="true" maxLevel="9" />
  30. </item>
  31. <item npcId="20629"> <!-- Karik -->
  32. <detail chance="9" skill="true" maxLevel="9" />
  33. </item>
  34. <item npcId="20636"> <!-- Forest of Mirrors Ghost -->
  35. <detail chance="9" skill="true" maxLevel="2" />
  36. </item>
  37. <item npcId="20637"> <!-- Forest of Mirrors Ghost -->
  38. <detail chance="9" skill="true" maxLevel="3" />
  39. </item>
  40. <item npcId="20638"> <!-- Forest of Mirrors Ghost -->
  41. <detail chance="9" skill="true" maxLevel="3" />
  42. </item>
  43. <item npcId="20639"> <!-- Mirror -->
  44. <detail chance="9" skill="true" maxLevel="3" />
  45. </item>
  46. <item npcId="20640"> <!-- Harit Lizardman -->
  47. <detail chance="9" skill="true" maxLevel="4" />
  48. </item>
  49. <item npcId="20641"> <!-- Harit Lizardman Grunt -->
  50. <detail chance="9" skill="true" maxLevel="4" />
  51. </item>
  52. <item npcId="20642"> <!-- Harit Lizardman Archer -->
  53. <detail chance="9" skill="true" maxLevel="4" />
  54. </item>
复制代码
由于显示不下了,所以截取了一部分,但格式都是以上这样的,希望做成如下效果即可:
以上代码存成一个sour.txt,执行批处理后,存成res.txt,用前两个举例内容如下:
  1. npcid chance skill maxlevel
  2. 20583 9 TRUE 1
  3. 20584 9 TRUE 1
复制代码
1

评分人数

    • Batcher: 感谢给帖子标题标注[已解决]字样PB + 2

第二组稍微麻烦一点,有两种,代码如下:
  1. <item npcId="25687"> <!-- Hekaton Prime -->
  2. <detail chance="5" absorbType="PARTY_ONE_RANDOM" levelList="10, 11, 12, 13, 14" />
  3. </item>
  4. </item>
  5. <item npcId="25677"> <!-- Water Spirit Lian -->
  6. <detail chance="10" absorbType="PARTY_ONE_RANDOM" levelList="12, 13" />
  7. <detail chance="5" absorbType="PARTY_ONE_RANDOM" levelList="14" />
  8. </item>
  9. <item npcId="25603"> <!-- Darion -->
  10. <detail chance="10" absorbType="PARTY_ONE_RANDOM" levelList="12, 13" />
  11. <detail chance="5" absorbType="PARTY_ONE_RANDOM" levelList="14" />
  12. <detail chance="3" absorbType="PARTY_ONE_RANDOM" levelList="15" />
  13. </item>
复制代码
上面仅是举例内容,这段就是把chance分开,把levelList分开,方法也是先把源内容存在sour.txt,整理输出后变成如下格式:
  1. npcid chance absorbType level
  2. 25678 5 PARTY_ONE_RANDOM 10
  3. 25678 5 PARTY_ONE_RANDOM 11
  4. 25678 5 PARTY_ONE_RANDOM 12
  5. 25678 5 PARTY_ONE_RANDOM 13
  6. 25678 5 PARTY_ONE_RANDOM 14
  7. 25677 10 PARTY_ONE_RANDOM 12
  8. 25677 10 PARTY_ONE_RANDOM 13
  9. 25677 5 PARTY_ONE_RANDOM 14
  10. 25603 10 PARTY_ONE_RANDOM 12
  11. 25603 10 PARTY_ONE_RANDOM 13
  12. 25603 5 PARTY_ONE_RANDOM 14
  13. 25603 3 PARTY_ONE_RANDOM 15
复制代码
谢谢各位大佬。

TOP

本帖最后由 aloha20200628 于 2024-2-24 19:34 编辑


代码说明》
通用不同组别的源文件;
任取源文件中一个唯一性标识词,如 ' skill=' 用于判断并构建对应组别的输出结果文件头
用1-2楼的两个示例分别测试通过
  1. @echo off &setlocal enabledelayedexpansion
  2. (findstr " skill=" sour.txt>nul&&echo,npcid chance skill maxlevel||echo,npcid chance absorbType level)>"res.txt"
  3. (for /f tokens^=1-6^delims^=^" %%1 in (' findstr "=" "sour.txt" ') do (
  4. if "%%~4"=="" (set "v1=%%2") else for %%v in (%%6) do (echo,!v1! %%2 %%4 %%v)
  5. ))>>"res.txt"
  6. endlocal&exit/b
复制代码
1

评分人数

    • 77七: 感谢分享技术 + 1

TOP

代码说明》
通用不同组别的源文件;
任取源文件中一个唯一性标识词,如 ' skill=' 用于判断并构建对应组 ...
aloha20200628 发表于 2024-2-24 12:49


您好,谢谢,可以使用,完美解决问题。

TOP

代码说明》
通用不同组别的源文件;
任取源文件中一个唯一性标识词,如 ' skill=' 用于判断并构建对应组 ...
aloha20200628 发表于 2024-2-24 12:49
  1. <item>
  2. <!-- Great Sword -->
  3. <ingredient count="1" id="78" />
  4. <!-- Neolithic Crystal - B -->
  5. <ingredient count="1" id="14678" />
  6. <!-- Great Sword - Lightning -->
  7. <production count="1" id="10870" />
  8. </item>
  9. <item>
  10. <!-- Great Sword - Health -->
  11. <ingredient count="1" id="4723" />
  12. <!-- Neolithic Crystal - B -->
  13. <ingredient count="1" id="14678" />
  14. <!-- Great Sword - Lightning - Health -->
  15. <production count="1" id="10871" />
  16. </item>
复制代码
请问一下,类似这种的,通过你的批处理我想直接修改能达到我这边通用,但好像改了不行,麻烦你帮忙看看这种效果:
78        14678        10870
4723        14678        10871

TOP

本帖最后由 aloha20200628 于 2024-2-24 19:33 编辑

回复 5# zhengwei007

针对5楼示例样本的代码如下
  1. @echo off &setlocal enabledelayedexpansion
  2. (for /f tokens^=1-4^delims^=^" %%1 in (' findstr "=" "sour.txt" ') do for /f "tokens=1 delims= < " %%a in ("%%~1") do if /i "%%~a"=="production" (echo,!v:~1! %%4&set "v=") else (set "v=!v! %%4")
  3. )>"res.txt"
  4. endlocal&exit/b
复制代码

TOP

回复 5# zhengwei007
此类问题,俺一般会使用第3方工具gawk(http://bcn.bathome.net/tool/4.1.0/gawk.exe)来处理:

对于1楼的样本:
  1. gawk -v"FS=\042"-v"OFS=\t" "BEGIN{FS=\"\042\";OFS=\"\t\";print\"npcid\tchance\tskill\tmaxlevel\"}/<item npcId=/,/<\/item>/{if(/<item npcId=/)A=$2;if(/<detail chance=/)print A,$2,$4,$6}" L1.txt>Out1.txt
复制代码
对于2楼的样本:
  1. gawk -v"FS=\042"-v"OFS=\t" "BEGIN{FS=\"\042\";OFS=\"\t\";print\"npcid\tchance\tabsorbType\tlevel\"}/<item npcId=/,/<\/item>/{if(/<item npcId=/)A=$2;if(/<detail chance=/){split($6,a,/, /);for(i=1;i in a;i++)print  A,$2,$4,a[i]}}" L2.txt>Out2.txt
复制代码
对于5楼的样本:
  1. gawk -v"FS=\042"-v"OFS=\t" "BEGIN{FS=\"\042\";OFS=\"\t\";A=\"\"}/<item>/,/<\/item>/{if(/<[^<]+\/>/){A?A=A\"\t\"$4:A=$4};if(/<\/item>/){print A;A=\"\"}}" L5.txt>Out5.1.txt
复制代码

TOP

回复  zhengwei007

针对5楼示例样本的代码如下
aloha20200628 发表于 2024-2-24 18:42



谢谢,已解决。

TOP

回复  zhengwei007
此类问题,俺一般会使用第3方工具gawk()来处理:

对于1楼的样本:对于2楼的样本: ...
hfxiang 发表于 2024-2-25 14:41



我想尝试修改,然后去获取别的内容,但……根本看不懂,奈何我不是这块料儿~

TOP

本帖最后由 qixiaobin0715 于 2024-2-26 16:47 编辑

1楼:
  1. @echo off
  2. echo,npcid chance skill maxlevel
  3. set /a _chance=_skill=1
  4. setlocal enabledelayedexpansion
  5. for /f "delims=<> " %%i in (sour.txt) do (
  6.     for %%j in (%%i) do (
  7.         if defined x1 (
  8.             set x1=
  9.             set str=%%~j
  10.         ) else if defined x2 (
  11.             set x2=
  12.             echo,!str! %%~j
  13.         ) else if defined x3 (
  14.             set x3=
  15.             set str=!str! %%~j
  16.         ) else (
  17.             if /i "%%j"=="npcid" (
  18.                 set x1=true
  19.             ) else if /i "%%j"=="maxlevel" (
  20.                 set x2=true
  21.             ) else if defined _%%j (
  22.                 set x3=true
  23.             )
  24.         )
  25.     )
  26. )
  27. pause
复制代码
2楼:
  1. @echo off
  2. echo,npcid chance absorbType levellist
  3. set /a _chance=_absorbType=1
  4. setlocal enabledelayedexpansion
  5. for /f "delims=<> " %%i in (sour.txt) do (
  6.     for %%j in (%%i) do (
  7.         if defined x1 (
  8.             set x1=
  9.             set str1=%%~j
  10.         ) else if defined x2 (
  11.             set x2=
  12.             for %%l in (%%~j) do echo,!str1!!str2! %%l
  13.             set str2=
  14.         ) else if defined x3 (
  15.             set x3=
  16.             set str2=!str2! %%~j
  17.         ) else (
  18.             if /i "%%j"=="npcid" (
  19.                 set x1=true
  20.             ) else if /i "%%j"=="levellist" (
  21.                 set x2=true
  22.             ) else if defined _%%j (
  23.                 set x3=true
  24.             )
  25.         )
  26.     )
  27. )
  28. pause
复制代码
5楼:
  1. @echo off
  2. for /f "delims=<> " %%i in (sour.txt) do (
  3.     if "%%i"=="item" (
  4.         setlocal enabledelayedexpansion
  5.     ) else if "%%i"=="/item" (
  6.         echo,!str!
  7.         endlocal
  8.     )
  9.     for %%j in (%%i) do (
  10.         if defined x (
  11.             set x=
  12.             set str=!str!%%~j
  13.         ) else if /i "%%j"=="id" (
  14.             set x=true
  15.         )
  16.     )
  17. )
  18. pause
复制代码
代码未经测试,可能会有问题,大体思路应当可行。

TOP

RE: 求助BAT代码中提取几个关键词写到csv中

  1. <npc id="20583" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1"/><!-- Timak Orc -->
  2. <npc id="20584" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1"/><!-- Timak Orc Archer -->
  3. <npc id="20794" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1"/><!-- Blade Stakato -->
  4. <npc id="20795" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1"/><!-- Blade Stakato Worker -->
  5. <npc id="20796" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1"/><!-- Blade Stakato Warrior -->
  6. <npc id="20797" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2"/><!-- Blade Stakato Drone -->
  7. <npc id="20798" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2"/><!-- Water Giant -->
  8. <npc id="20799" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2"/><!-- Queen Undine Lad -->
  9. <npc id="20800" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Eva's Seeker -->
  10. <npc id="20801" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Theeder Piker -->
  11. <npc id="20802" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Theeder Mage -->
  12. <npc id="20803" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Doll Master -->
  13. <npc id="20821" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Erin Ediunce -->
  14. <npc id="20823" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Tribe Soldier -->
  15. <npc id="20826" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Tribe Archer -->
  16. <npc id="20827" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Tribe Warrior -->
  17. <npc id="20828" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Tribe Shaman -->
  18. <npc id="20829" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Tribe Overlord -->
  19. <npc id="20830" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Guardian Angel -->
  20. <npc id="20831" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Seal Angel -->
  21. <npc id="20848" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2"/><!-- Light Bringer -->
  22. <npc id="20849" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1"/><!-- Light Worm -->
  23. <npc id="20860" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Seal Angel -->
  24. <npc id="20986" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Sairon -->
  25. <npc id="20987" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Sairon's Doll -->
  26. <npc id="20988" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Sairon's Puppet -->
  27. <npc id="20994" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Garden Guard Leader -->
  28. <npc id="20995" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Garden Guard -->
  29. <npc id="21006" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7"/><!-- Doom Servant -->
  30. <npc id="21069" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Guardian Prefect -->
  31. <npc id="21070" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Seal Archangel -->
  32. <npc id="21071" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Seal Archangel -->
  33. <npc id="21072" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5;6;7;8;9"/><!-- Platinum Guardian Chief -->
  34. <npc id="21611" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2"/><!-- Unpleasant Humming -->
  35. <npc id="21612" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2"/><!-- Unpleasant Humming -->
  36. <npc id="21614" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Death Flyer -->
  37. <npc id="21615" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Death Flyer -->
  38. <npc id="21617" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Fiend Archer -->
  39. <npc id="21620" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Musveren -->
  40. <npc id="21621" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3"/><!-- Musveren -->
  41. <npc id="21623" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Zaken's Guard -->
  42. <npc id="21624" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Zaken's Guard -->
  43. <npc id="21626" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Kaim Vanul -->
  44. <npc id="21627" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Kaim Vanul -->
  45. <npc id="21629" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Pirate Zombie Captain -->
  46. <npc id="21630" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4"/><!-- Pirate Zombie Captain -->
  47. <npc id="21632" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Doll Blader -->
  48. <npc id="21633" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Doll Blader -->
  49. <npc id="21635" chanceStage="100" chanceBreak="20" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Vale Master -->
  50. <npc id="21636" chanceStage="150" chanceBreak="0" skill="true" absorbType="LAST_HIT" levelList="0;1;2;3;4;5"/><!-- Vale Master -->
  51. <npc id="22215" chanceStage="100" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Tyrannosaurus -->
  52. <npc id="22216" chanceStage="100" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Tyrannosaurus -->
  53. <npc id="22217" chanceStage="100" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Tyrannosaurus -->
  54. <npc id="25109" chanceStage="35" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Antharas Priest Cloe -->
  55. <npc id="25163" chanceStage="35" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Roaring Skylancer -->
  56. <npc id="25202" chanceStage="35" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Krokian Padisha Sobekk -->
  57. <npc id="25269" chanceStage="35" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Beast Lord Behemoth -->
  58. <npc id="25283" chanceStage="100" chanceBreak="0" skill="false" absorbType="FULL_PARTY" levelList="10;11"/><!-- Lilith -->
  59. <npc id="25286" chanceStage="100" chanceBreak="0" skill="false" absorbType="FULL_PARTY" levelList="10;11"/><!-- Anakim -->
  60. <npc id="25319" chanceStage="75" chanceBreak="0" skill="false" absorbType="FULL_PARTY" levelList="12"/><!-- Ember -->
  61. <npc id="25328" chanceStage="35" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Eilhalder von Hellmann -->
  62. <npc id="25337" chanceStage="75" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Anakazel -->
  63. <npc id="25338" chanceStage="75" chanceBreak="0" skill="false" absorbType="FULL_PARTY" levelList="12"/><!-- Anakazel -->
  64. <npc id="25453" chanceStage="35" chanceBreak="0" skill="false" absorbType="PARTY_ONE_RANDOM" levelList="10;11"/><!-- Meanas Anor -->
  65. <npc id="29020" chanceStage="100" chanceBreak="0" skill="false" absorbType="FULL_PARTY" levelList="10;11"/><!-- Baium -->
  66. <npc id="29022" chanceStage="100" chanceBreak="0" skill="false" absorbType="FULL_PARTY" levelList="10;11"/><!-- Zaken -->
复制代码
请问这代码为什么输出不了上面正确的结果???

TOP

本帖最后由 aloha20200628 于 2024-3-16 19:13 编辑

回复 11# zhengwei007

数据不在同一行...
处理11楼新示例样本数据的代码如下
  1. @echo off &setlocal enabledelayedexpansion
  2. (for /f tokens^=1-12^delims^=^" %%a in (' findstr "=" "sour.txt" ') do (
  3. (set "vl=%%l"&echo,%%b %%d %%f %%h %%j !vl:;= !)
  4. ))>"res.txt"
  5. endlocal&exit/b
复制代码

TOP

返回列表