没有处理空行:- @echo off
- set file="a.txt"
- set /a n=0,m=0
- for /f "usebackq eol= delims=" %%a in (%file%) do (
- set /a n+=1,"1/(4-n)" 2>nul || (
- set /a n=1,m+=1,"1/(2-m)" 2>nul || exit /b
- for /f "delims=[ tokens=*" %%i in ("%%a") do if "%%i" neq "%%a" exit /b
- )
- if defined file set file=>%file%
- echo;%%a>>%file%
- )
复制代码
[ 本帖最后由 tireless 于 2009-7-19 13:31 编辑 ] |