用了N多的FOR:- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in (a.txt) do (
- set str=%%i
- if "!str:~0,1!"=="A" (
- set var=!str:~-3!
- if !var! gtr 0 if !var! lss 999 set /a n+=1
- )
- call,set ".!n!=%%.!n!%%"%%i" "
- )
- for /f "tokens=2 delims==" %%i in ('set .') do (
- for /f "tokens=1" %%a in ("%%i") do (
- set hh=%%a&set num=!hh:~2,3!&set _!num!=%%i
- ))
- for /f "tokens=2 delims==" %%i in ('set _') do (
- for %%b in (%%i) do echo %%~b
- echo\
- )
- pause
复制代码
[ 本帖最后由 keen 于 2009-5-15 00:01 编辑 ] |