- @echo off&setlocal enabledelayedexpansion
- for /f "skip=1 tokens=1-3" %%i in (a.txt) do (
- if defined c call :l %%i
- if not defined c if %%k geq 0 set c=%%j
- )
- pause
- goto :eof
-
- :l
- set c=
- for /f "skip=%1 tokens=1-3" %%i in (a.txt) do (
- if defined c (
- set /a d=%%i-!r!
- if !d! geq 4 if !d! leq 8 if %%k lss 0 if %%j equ !c! (
- echo %%i %%j %%k
- set c=
- goto :eof
- )
- )
- if not defined c if %%k geq 0 (
- set r=%%i
- set c=%%j
- )
- )
复制代码
|