123.txt是你原文本的名字,你可以任意更改- @ECHO OFF
- Setlocal enableDelayedExpansion
- for /f "tokens=*" %%i in ('sort 123.txt') do (
- set a=0
- for /f "tokens=*" %%j in (123.txt) do (
- if %%i==%%j set /a a+=1
- )
- if !a!==1 set b=1
- if !b!==1 echo %%i
- if !a! geq 2 (
- set /a c+=1
- )
- if !c!==1 echo %%i
- if !c!==!a! set c=0
- )
复制代码
|