如果要保持文本行原有顺序,可以这样:- @echo off
- (for /f "delims=" %%a in (1.txt) do (
- echo,%%a
- set _"%%a"=true
- set /a n+=1
- if "%%a"=="====" goto :a
- ))>2.txt
- :a
- setlocal enabledelayedexpansion
- (for /f "skip=%n% delims=" %%i in ('type 1.txt') do (
- if not defined _"%%i" (
- echo,%%i
- ) else (
- if "!_"%%i"!"=="true" (
- echo,%%i
- set _"%%i"==false
- )
- )
- ))>>2.txt
- pause
复制代码
|