文件最后一行必须是空行,否则会丢失最后一行- @echo off
- md tem
- for /f "tokens=1* delims=:" %%i in ('findstr /be "[0-9][0-9]*" *.txt') do (
- set "lr=%%j"
- setlocal enabledelayedexpansion
- if "!lr:~4,1!"=="" (
- if not "!lr:~3,1!"=="" (
- endlocal
- >>tem\%%~ni.txt echo %%j F,0,F,00
- set /a n+=1
- )
- ) else endlocal
- )
- echo 新文件在 tem 文件夹中,按任意键打开。。。
- echo.&echo 总行数 %n% 行
- pause>nul
- start tem
复制代码
|