哎,始终是效率问题,特殊字符也麻烦- @echo off&setlocal enabledelayedexpansion
- ::下面设置每行显示的字节数
- set/a num=60
- set/a s=num/2-1
- for /l %%i in (1,1,%num%) do set "sign=!sign!."
- for /f "delims=" %%a in ('findstr/n ".*" a.txt') do (
- set "str=%%a"&set "str=!str:*:=!"
- if defined str for /f "tokens=* delims= " %%b in ("!str!") do set "str= %%b"
- if defined str (set/a n=%s%&call :check) else echo/
- )
- pause>nul&exit
- :check
- if not defined str goto :eof
- set/a n+=1,m=n+1
- set var=!str:~,%n%!
- echo/%var%|findstr "%sign%" >nul 2>nul&&(
- set str=!str:~%n%!&echo/%var%&set/a n=%s%&goto check)||(
- if "!var!" equ "!str:~,%m%!" (echo/%var%&goto :eof) else goto check
- )
复制代码
|