复制代码
- @echo off
- for /f "delims=" %%a in ('more tuigj.txt') do echo %%a
- pause
- type tuigj.txt
- pause
- more /T8 /e tuigj.txt
- pause
- findstr "[0-9]" tuigj.txt
- pause
复制代码
- @echo off
- setlocal enabledelayedexpansion
- for /l %%i in (1,1,43) do set "b= !b!" %% 连一块了,找个换行点。 %%
- set /p s=<"tuigj.txt"
- set "s=!s:%b%=%b%&echo.!"
- for /f "delims=" %%a ^% 如果只需要显示直接用 echo 语句即可。 ^%
- in ('cmd /c echo %%s%%') ^% 要获取每一行供使用,此命令获得输出。 ^%
- do echo %%a
- pause
复制代码
- sed "s/\(w*%\)/\1\n/g" tuigj.txt
for 赋值:复制代码
- @echo on
- sed "s/\(A: [0-9]\+.[0-9]\+ (\)\([0-9]\+.[0-9]\+\)\() of [0-9]\+.[0-9]\+ (\)\([0-9]\+.[0-9]\+\)\() \w\+.\w\+%%\)\( \+\)/\2\n/g" tuigj.txt
- @echo off
复制代码
- for /f %%a in ('sed "s/\(A: [0-9]\+.[0-9]\+ (\)\([0-9]\+.[0-9]\+\)\() of [0-9]\+.[0-9]\+ (\)\([0-9]\+.[0-9]\+\)\() \w\+.\w\+%%\)\( \+\)/\2\n/g" tuigj.txt') do echo %%a
复制代码
- sed: couldn't write 1698239 items to stdout: Not enough space
复制代码
- @set @bat=1 // & cscript -nologo -e:jscript "%~f0" & pause & exit /b
- f = "C:\\a b\\tuigj.txt";
- fso = new ActiveXObject('Scripting.FileSystemObject');
- s = fso.OpenTextFile(f).ReadAll().replace(/\r\n?/g,'\r\n');
- fso.OpenTextFile('02.txt',2,true).Write(s);
- WScript.Echo(s);
C:\Test>type test.bat @set @bat=1 // & cscript -nologo -e:jscript "%~f0" & exit /b f = "C:\\test\\1.txt"; fso = new ActiveXObject('Scripting.FileSystemObject'); s = fso.OpenTextFile(f).ReadAll().replace(/\r\n?/g,'\r\n'); fso.OpenTextFile('02.txt',2,true).Write(s); C:\Test>test.bat C:\Test>type 02.txt A: 0.0 (00.0) of 17.0 (17.0) 1.5% A: 0.0 (00.0) of 17.0 (17.0) 1.5% A: 0.0 (00.0) of 17.0 (17.0) 1.5% A: 0.0 (00.0) of 17.0 (17.0) 1.5% A: 0.0 (00.0) of 17.0 (17.0) 1.4% A: 0.0 (00.0) of 17.0 (17.0) 1.4% A: 0.1 (00.0) of 17.0 (17.0) 1.4% A: 48.2 (48.1) of 260.0 (04:20.0) 0.6% A: 153.2 (02:33.2) of 260.0 (04:20.0) 0.5% |
原帖由 powerbat 于 2010-10-11 19:28 发表
@set @bat=1 // & cscript -nologo -e:jscript "%~f0" & pause & exit /b
f = "C:\\a b\\tuigj.txt";
fso = new ActiveXObject('Scripting.FileSystemObject');
s = fso.OpenTextFile(f).ReadAll().replace(/\r\n ...
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |