@echo off
setlocal enableextensions disabledelayedexpansion
for /r %f in (xis_*) do More +1 %~nxf >> No_header_%~nxf
set "search=:20:"
set "replace={:20:"
for /f "delims=" %%i in ('type (No_header*.txt) ^& break ^> (No_header_*.txt) ') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
>>No_header*.txt echo(!line!
endlocal
)
我正在尝试跳过文本文件中的标题行并替换:20:
为{:20:
。我已经写了,并且几乎实现了我的目标。
答案1
使用计数器确定您在哪条线上,然后据此执行您的操作。
就像是:
SET /A MYCOUNT=0
for ... do (
SET /A MYCOUNT+=1
IF %MYCOUNT% GTR 1 (
' Do stuff
)
)