如何把一个文件的第3行——第90行的内容找出来,并传递给新的*.txt文件!谢谢!
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
for /f "tokens=1* delims=:" %a in ('findstr /n .* test.txt^|findstr /r /c:"^2:" /c:"^89:"') do @echo %b
@echo off
for /l %%a in (3,1,90) do call :need %%a
:need
for /f "tokens=1* delims=:" %%i in ('findstr /n . 1.txt') do if %%i==%1 echo %%j>>2.txt
for /f "delims=: tokens=1*" %%a in ('findstr/n .* test.txt') do @(if %%a equ 3 (echo\%%b) else (if %%a equ 90 echo\%%b))>>ok.txt
@echo off
for /l %%n in (3,1,90) do call :need %%n
pause
exit
:need
set /a line=%1-1
for /f "skip=%line% delims=" %%i in ('more test.txt') do (
echo %%i
goto :eof
)@echo off
setlocal EnableDelayedExpansion
for /l %%n in (31,90) do call :need %%n
pause
exit
:need
set /a line=%1-1
for /f "skip=%line% delims=" %%i in ('findstr /n .* "test.txt"') do (
set "str=%%i"
set "str=!str:%1:=!"
if not "!str!" == "" (echo !str!) else echo.
goto :eof
)