本帖最后由 xxpinqz 于 2014-1-23 12:24 编辑
回复 10# 1e3e
用上面的改改,大约如此- @echo off&setlocal enabledelayedexpansion
- set /a num=f=10000
- (for %%i in (*.txt) do (
- set /a m=n=10000,f+=1
- set "y="
- for /f "tokens=1* delims=:" %%a in ('type "%%i"^|findstr /n .*') do (
- set "str=%%b"
- if "%%b" == "" (
- if defined y set y=&set/an+=1
- ) else (
- for /f "tokens=*" %%a in ("%%b") do (
- set/a m+=1
- if not "%%a"=="" echo,!n!:!f!!m!:%%b
- )
- set y=.
- )
- )
- ))>tmp
- (for /f "tokens=1-2* delims=:" %%a in ('type tmp^|sort') do (
- if %%a neq !num! set/a num+=1&echo,
- echo,%%c
- ))>all.txt
- del tmp
- start all.txt
复制代码 如果也要按顶楼要求,改下序号- @echo off&setlocal enabledelayedexpansion
- set /a num=f=10001
- (for %%i in (*.txt) do (
- set /a m=n=10001,f+=1
- set "y="
- for /f "tokens=1* delims=:" %%a in ('type "%%i"^|findstr /n .*') do (
- set "str=%%b"
- if "%%b" == "" (
- if defined y set y=&set/an+=1
- ) else (
- for /f "tokens=*" %%a in ("%%b") do (
- set/a m+=1,nn=n%%10000
- if not "%%a"=="" echo,!n!:!f!!m!:%%b 项目规划地!nn!部分
- )
- set y=.
- )
- )
- ))>tmp
- (for /f "tokens=1-2* delims=:" %%a in ('type tmp^|sort') do (
- if %%a neq !num! set/a num+=1&echo,
- echo,%%c
- ))>all.txt
- del tmp
- start all.txt
复制代码
|