请教: 如何用批处理删除文本文件中以指定字符开始的行?
比如想删除1.txt中以aaa空格“aaa ”为开始的行。谢谢?
比如想删除1.txt中以aaa空格“aaa ”为开始的行。谢谢?
Windows 一键还原
http://www.yjhy.com
http://www.yjhy.com
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off
for /f "delims=" %%i in ('findstr /n .* 1.txt') do call :intercept "%%i☆"
pause
goto :eof
:intercept
set str=%1
set "str=%str:~1,-1%"
set "str=%str:*:=%"
if not "%str:~0,4%"=="aaa " echo "%str:~0,-1%"
goto :eof
@echo off
for /f "delims=" %%i in ('findstr /n .* 1.txt') do call :intercept "%%i☆"
pause
goto :eof
:intercept
set str=%1
set str=%str:~1,-1%
set str=%str:*:=%
if not "%str:~0,4%"=="aaa " echo.%str:~0,-1%
goto :eof
@echo off
findstr /b /i /v /c:"Rem " 1.txt>2.txt
start 2.txt