不太明白你强调每行127字节是什么意识?
你是说for不能处理127字节的行吗? 我测试不出来.
我的a.txt内容是通过以下代码得到的- @echo off
- cd.>a.txt
- for /l %%a in (1 1 129) do set /p=%%a <nul>>a.txt
- echo.>>a.txt
- for /l %%a in (1 1 10) do set /p=%%a <nul>>a.txt
- echo.>>a.txt
- for /l %%a in (3 1 40) do set /p=%%a <nul>>a.txt
- echo.>>a.txt
- for /l %%a in (100 1 120) do set /p=%%a <nul>>a.txt
- echo.>>a.txt
复制代码 列出a.txt中,从未重复过的单词,每行10个.- @echo off
- for /f "delims=" %%a in (a.txt) do (
- for %%b in (%%a) do set /a _%%b+=1
- )
- setlocal EnableDelayedExpansion
- for /f "tokens=1,2 delims=_=" %%a in ('set _') do (
- if "%%b"=="1" (
- set /a num+=1
- set/p=%%a <NUL
- if !num! equ 10 set num=0&echo.
- ))
- pause
复制代码
[ 本帖最后由 随风 于 2007-10-29 22:15 编辑 ] |