- 帖子
- 873
- 积分
- 1455
- 技术
- 189
- 捐助
- 0
- 注册时间
- 2021-10-13
|
回复 11# zhengwei007
用7楼代码随机测试了11楼提供的几个文件(代码中的 1.xml 改为测试文件名),均予通过...
以下代码是将7楼代码改为批量处理版本,可将当前目录下的全部 *.xml 中的目标字段值析取整合到 new.xml,测试结果共析取9208条数据,与源文件名区间号码一致...- @echo off &setlocal enabledelayedexpansion &echo,稍候...
- set "lst=,item id, type, name,icon,bodypart,armor_type,weight,soulshots,spiritshots,crystal_type,p_dam,rnd_dam,weapon_type,critical,hit_modify,atk_speed,m_dam,price,sellable,dropable,tradeable,pAtk,mAtk,rCrit,accCombat,pAtkSpd,pAtk1,mAtk1,pDef,"
- set "v=!lst!"
- (echo,item,type,name,icon,bodypart,armor_type,weight,soulshots,spiritshots,crystal_type,p_dam,rnd_dam,weapon_type,critical,hit_modify,atk_speed,m_dam,price,sellable,dropable,tradeable,pAtk,mAtk,rCrit,accCombat,pAtkSpd,pAtk1,mAtk1,pDef
- for /f "delims=" %%F in ('dir/b/a-d *.xml') do for /f tokens^=1-7^delims^=^ ^<^=^" %%a in (
- 'findstr /rbi /c:" *.*=\"^" /c:" ^</item^>" "%%F" ') do (
- if /i "%%a"=="item id" (
- set "v=!v:%%a,=%%b,!"&set "v=!v:%%c,=%%d,!"&set "v=!v:%%e,=%%f,!"
- ) else if "%%e"==" />" (set "v=!v:%%b,=%%d,!"
- ) else if "%%g"==" />" (
- set "go=1"&for %%s in ("%%f","%%f1") do if defined go if "!v:%%~s,=%%b,!" neq "!v!" (
- set "go="&set "v=!v:%%~s,=%%b,!")
- ) else if /i "%%a"=="/item>" ((for %%s in (!lst!) do set "v=!v:,%%s,=,,!")&echo,!v:~1,-1!&set "v=!lst!")
- ))>"new.xml"
- endlocal&pause&exit/b
复制代码
|
|