用字符串替换写了一个,兼顾1楼和11楼。- @echo off
- cd /d "%~dp0"
- set /p n=input:
- set list=0001
- for /f "delims=" %%i in ('dir /b /a-d *.rcp ^|find /v "04T"') do (
- setlocal
- for /f "tokens=1* delims=:" %%a in ('findstr /n "C0_E0,[1-3],0,[0-1].*C0_E0,[1-3],0,[0-1]" ^< "%%i"') do (
- set #%%a=1
- )
- (for /f "tokens=1* delims=[]" %%a in ('find /n /v "" ^< "%%i"') do (
- if defined #%%a (
- set str=%%b
- setlocal enabledelayedexpansion
- set str2=!str:*C0_E0,=!
- set str2=!str2:~5!
- call set str1=%%str:!str2!=%%
- for %%x in ("C0_E0,1,0,0" "C0_E0,2,0,0" "C0_E0,3,0,1") do (
- call set str1=%%str1:%%~x=C0_E0,!n:~0,1!,0,!list:~%n:~0,1%,1!%%
- call set str2=%%str2:%%~x=C0_E0,!n:~1,1!,0,!list:~%n:~1,1%,1!%%
- )
- echo !str1!!str2!
- endlocal
- ) else (
- echo=%%b
- )
- )) > "%%~ni_2%%~xi"
- endlocal
- )
- pause
复制代码
|