灯塔彭于晏 当前离线
一级士官
smss 当前离线
中尉
$global:n = 0; $arr = (gc A.txt -ReadCount 0) -notmatch '^\s*$'; $str = (gc B.txt -ReadCount 0) -join "`r`n"; $str = [regex]::Replace($str, '#', {$arr[$global:n++]}); sc B.txt -Value $str;复制代码
TOP
WHY 当前离线
上校
@echo off setlocal enabledelayedexpansion (for /f "delims=" %%i in (b.txt) do ( set "s=%%i" if "!s:>#<=!" NEQ "!s!" ( set /p "n=" for %%j in ("!n!") do set "s=!s:>#<=>%%~j<!" ) echo;!s! )) < a.txt pause复制代码
评分人数
WHY 发表于 2020-12-16 14:34
qixiaobin0715 当前离线
大校
@echo off setlocal enabledelayedexpansion set m=0 for /f "delims=" %%a in (a.txt) do ( set "str=%%a" set /a m+=1&set _!m!=%%a ) set n=1 (for /f "delims=" %%b in (b.txt) do ( set "var=%%b" set /a num=_!n! for %%c in (!num!) do set "var=!var:>#<=>%%c<!" if not "!var!"=="%%b" set /a n+=1 echo !var! ))>c.txt pause复制代码