我有这样的XML:
<aa>
<bb>123</bb>
<bb>456</bb>
</aa>
我想用DOS批次替换它
<aa>
<bb>123 / 456</bb>
</aa>
但我不知道该怎么做。
赞赏任何acode snippest
答案 0 :(得分:1)
试试这个:
@echo off
setlocal enabledelayedexpansion
set "search=bb"
for /f "delims=" %%i in (file) do (
set "line=%%i"
if "!line:%search%=!" neq "!line!" (
if not defined first (
for /f "tokens=2delims=<> " %%a in ("!line!") do set "first=%%a"
) else (
for /f "tokens=2delims=<> " %%a in ("!line!") do set "last=%%a"
echo(^<bb^>!first! / !last!^</bb^>
set "first="
)
) else (
echo(!line!
)
)
特别是对于年轻的生气: