clsall 当前离线
列兵
newswan 当前离线
上尉
$file = "1.txt" $fc = get-content -raw $file $i = 0 while ($fc -match '(?s)(<smilie .*?</smilie>)(.*)') { $i++ $s += $matches[1] -replace "ac",("ac" + [string] $i) $fc = $matches[2] } $s + $fc | out-file $file复制代码
TOP
qixiaobin0715 当前离线
大校
@echo off setlocal enabledelayedexpansion for /f "delims=" %%a in (test.txt) do ( set "str=%%a" if not "!str:<smilie smilie=!"=="!str!" set /a n+=1 for %%i in (!n!) do set "str=!str:/ac=/ac%%i!"&echo,!str! ) pause复制代码