- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in (a.dat) do (
- set "str=%%i"
- if defined Line (
- for /f %%a in ("!str:*|KD1=!") do set "s1=%%a"
- set "Line="
- )
- if "!str:*|Db =!" neq "!str!" (
- for /f "tokens=1-2" %%a in ("!str:*|KD2 =!") do set "s2=%%b"
- for /f %%a in ("!str:*|Db =!") do set "s3=%%a"
- for /f %%a in ("!str:*|Df =!") do (
- for /f "tokens=1-2 delims=." %%A in ("!s3!") do (
- for /f "tokens=1-2 delims=." %%C in ("%%a") do (
- if %%A equ %%C (
- if 1%%B lss 1%%D set "s3=%%a"
- ) else if %%A lss %%C set "s3=%%a"
- )
- )
- )
- for /f %%a in ("!str:*|Z =!") do set "s4=%%a"
- )
- if defined s4 (
- echo !s1! !s2! !s3! !s4!
- set s4=
- )
- if "!str: Start-Line =!" neq "!str!" set "Line=0"
- )
- pause
复制代码
|