0
@echo off
rem Let findstr to find the LINE you want (only once):
for /f "delims=" %%a in ('findstr "to_timestamp" t1.txt') do set "_line=%%a"
SET _line2=%_line:*to_timestamp=%
SET _line3=%_line2:*)=%
set _rep_str=('07-10-13 07:07:29','%%d-%%m-%%y %%h:%%i:%%s')
CALL SET _result=%%_line:%_line2%=%%
CALL SET _result2=%%_line2:%_line3%=%%
CALL SET _result=%%_line:%_line2%=%%
CALL SET _result=%_result:to_timestamp=STR_TO_DATE%
echo %_result%%_rep_str%%_line3% >> Output.txt
::echo %_rep_str% >> Output.txt
::echo %_line3% >> Output.txt
PAUSE
上面的代碼是工作的FINDSTR第一行//發生,但我想在文本文件中的每一行執行相同的操作。批處理文件循環使用FINDSTR
如何做到這一點?
你能給我們一些樣本輸入和期望的輸出嗎?可以更容易地理解你的問題。 –