本帖最后由 tmplinshi 于 2011-6-24 12:35 编辑
- @echo off
- setlocal disabledelayedexpansion
-
- set "file=a.txt"
- set "begin=<def_ip>"
- set "end=<mac2ip>"
- set "_skip="
-
- findstr /n .* "%file%" >..tmp
-
- (
- for /f "delims=" %%i in (..tmp) do (
- set str=%%i
- setlocal enabledelayedexpansion
- set str=!str:*:=!
- if /i "!str!" == "!begin!" set _skip=#
- if /i "!str!" == "!end!" set _skip=
- if not defined _skip echo,!str!
- for %%i in ("!_skip!") do (
- endlocal
- set _skip=%%~i
- )
- )
- ) >"%file%"
-
- del ..tmp
复制代码
|