- @echo off&setlocal enabledelayedexpansion
- for /f %%a in ('find /c /v ""^<a.txt') do (
- for /l %%b in (1 1 %%a) do (
- set str=&set /p str=
- if !n! lss 8 echo;!str!
- if defined str if !str:^&^=! neq !str! set /a n+=1
- )
- )<a.txt
- pause
复制代码 再来个恶心的:- @echo off
- for /f "tokens=1,2 delims=:" %%a in ('findstr /n "&" a.txt^|findstr /n .') do (
- echo %%a|find "8">nul&&for /f %%a in ('find /c /v ""^<a.txt') do set /a n=%%a-%%b
- )
- set n|findstr "^n=">nul 2>&1&&sort /+128 a.txt|more +%n%|sort /+128
- pause
复制代码
|