- @echo off&setlocal enabledelayedexpansion
- cd "%~dp0"
- set "input=1.txt"
- (for /f "delims=" %%i in (%input%) do (
- set /a n=%%i-!L!
- if not defined f (
- set /a f=%%i
- ) else if !n! equ 1 (
- set /a e=%%i,m+=1
- ) else if !m! lss 1 (
- echo,!f!
- set /a f=%%i,m=0
- ) else (
- echo,!f!-!e!
- set /a f=%%i,m=0
- )
- set /a L=%%i
- )
- if !m! lss 1 (echo,!f!) else (echo,!f!-!e!)
- )>out_%input%
复制代码
|