统计文本中任一行字符串的个数,例如说:某行有 sdgdsg sdgdsg sdgfdgh 几个字符串,如何知道是3个
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@Echo Off&SetLocal EnableDelayedExpansion
set/p file=Please input the file you want to check:
if not defined file (echo Error&pause&exit/b)
if not exist "%file%" (echo Error&pause&exit/b)
for /f "delims=: tokens=1*" %%a in ('findstr /n .* "%file%"') do (
set b=&set a=%%b
if not "!a!"=="" (
for %%h in (!a!) do set /a b+=1
echo/Line %%a:!b! words
) else (echo/Line %%a:0 words)
)
pause