我有一个问题,在一个文件中我有这个:
plot1:
8 lines of content
plot2:
8 lines of content
plot3:
8 lines of content
plot4:
8 lines of content
plot5:
8 lines of content
plot6:
8 lines of content
plot7:
8 lines of content
plot8:
8 lines of content
plot9:
8 lines of content
plot10:
8 lines of content
plot11:
8 lines of content
plot12:
8 lines of content
plot13:
8 lines of content
plot14:
8 lines of content
plot15:
8 lines of content
plot16:
8 lines of content
plot17:
8 lines of content
plot18:
8 lines of content
plot19:
8 lines of content
plot20:
8 lines of content
plot21:
8 lines of content
plot22:
8 lines of content
plot23:
8 lines of content
plot24:
8 lines of content
plot25:
8 lines of content
plot26:
8 lines of content
plot27:
8 lines of content
plot28:
8 lines of content
plot29:
8 lines of content
我希望能够选择一个数字来替换字图旁边的数字1并递增到结尾。因此,例如用60替换1并获得plot60直到plot89。
答案 0 :(得分:0)
@echo off
setlocal enableextensions disabledelayedexpansion
(for /f "delims=" %%a in (file.txt
) do for /f "tokens=2 delims=1234567890 " %%b in ("%%~a"
) do if not "%%b"==":" (
echo(%%~a
) else for /f "tokens=1 delims=plot:" %%c in ("%%~a"
) do (
set /a "n=%%c+59"
setlocal enabledelayedexpansion
echo(plot!n!:
endlocal
)) > out.txt