- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=*" %%a in (1.txt) do (
- set "str=%%a"
- if not "!str:~0,3!"=="123" (if not "!str:~0,3!"=="456" (if not "!str:~0,3!"=="abc" echo %%a>>2.txt)))
- for /f "tokens=1* delims= " %%a in (2.txt) do set "head=%%a"&set "tail=%%b"&call :lp "%%b"
- pause&exit
- :lp
- for /f "tokens=1* delims= " %%i in ("!tail!") do (
- set "head=!head! %%i"&set "tail=%%j"
- if not "!tail!"=="" (goto lp) else echo !head!>>final.txt
- )
复制代码
|