俺写个程序行不?
setlocal enabledelayedexpansion
cd.>re.txt
for /f "tokens=1* delims=:" %%i in ('findstr /n "red" test.txt') do (
set/a num=%%i
set/a num+=3
)
for /f "tokens=1* delims=:" %%i in ('findstr /n ".*" test.txt') do (
set/a num2=%%i
if !num2!==!num! (
set str=%%j
echo !str!|findstr "apple">>re.txt || echo no apple >>re.txt
)
)
pause