联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ccccccccccccccccccccccccccccccccccccccc eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ggggggggggggggggggggggggggggggggggggggg wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh ccccccccccccccccccccccccccccccccccccccc iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj ggggggggggggggggggggggggggggggggggggggg nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
@echo off for /f "tokens=*" %%i in ('findstr /n .* 1.txt') do ( for /f "tokens=*" %%j in ('findstr /n .* 2.txt') do ( set var=%%i set str=%%j setlocal enabledelayedexpansion if "!var:~,1!"=="!str:~,1!" echo !var:~2,50!&echo !str:~2,50! endlocal ) ) pause
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh ccccccccccccccccccccccccccccccccccccccc iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj ggggggggggggggggggggggggggggggggggggggg nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
@echo off for /f "tokens=1* delims=:" %%a in ('findstr /n .* 1.txt') do ( set __%%a=%%b&set max=%%a ) for /f "tokens=1* delims=:" %%a in ('findstr /n .* 2.txt') do ( set ++%%a=%%b&set str=%%a ) if %str% gtr %max% set max=%str% setlocal enabledelayedexpansion for /l %%a in (1 1 %max%) do ( if defined __%%a echo !__%%a! if defined ++%%a echo !++%%a! ) pause
@echo off set max=-1 for /f "delims=" %%a in (1.txt) do ( echo %%a&set /a max+=1 call :loop %%max%% ) pause :loop if %max% equ 0 (set skip=) else set "skip=skip=%max%" for /f "%skip% delims=" %%i in (2.txt) do echo %%i&goto :eof goto :eof
Originally posted by 26933062 at 2008-4-1 04:12: 呵呵, 为何非要在一个循环中完成,你的那个代码,效率是个大问题,1.txt有多少行,就要把2.txt循环多少遍。。。 怎么才算是一个循环啊?我觉得 ...
@ECHO OFF findstr /n .* a.txt>>c.txt echo.>>c.txt findstr /n .* b.txt>>c.txt for /l %%i in (1 1 6) do ( findstr %%i: c.txt >>d.txt ) for /f "delims=: tokens=1*" %%a in (d.txt) do ( echo %%b>>e.txt ) del c.txt del d.txt
@echo off for /f "tokens=*" %%i in ('findstr /n .* 1.txt') do ( for /f "tokens=*" %%j in ('findstr /n .* 2.txt') do ( set var=%%i set str=%%j setlocal enabledelayedexpansion if "!var:~,2!"=="!str:~,2!" echo !var:~2,50!&echo !str:~2,50! endlocal ) ) for /f "delims=: tokens=1" %%i in ('findstr /n .* 1.txt') do set n=%%i for /f "delims=: tokens=1" %%j in ('findstr /n .* 2.txt') do set m=%%j if %n% equ %m% pause&goto :eof if %n% lss %m% goto 2 :1 set /a n=%m% for /f "skip=%n%" %%i in (1.txt) do echo %%i pause&goto :eof :2 set /a n=%n% for /f "skip=%n%" %%j in (2.txt) do echo %%j pause&goto :eof
@echo off&setlocal for /f "delims=: tokens=1*" %%a in ('findstr /n .* 1.txt') do call:ansi %%a "%%b" goto:eof :ansi echo %~2 for /f "delims=: tokens=1*" %%y in ('findstr /n .* 2.txt^|findstr "^%1:.*"') do echo %%z
@ECHO OFF findstr /n .* a.txt>>c.txt for /f "delims=: tokens=1" %%i in (c.txt) do set max1=%%i echo.>>c.txt findstr /n .* b.txt>>c.txt for /f "delims=: tokens=1" %%i in (c.txt) do set max2=%%i set/a max=(max2-max1)-max1 if %max% leq 0 (set/a max=max1) else (set/a max=max2-max1) for /l %%a in (1 1 %max%) do ( findstr %%a: c.txt >>d.txt ) for /f "delims=: tokens=1*" %%a in (d.txt) do ( echo %%b>>e.txt )
Originally posted by ansipeter at 2008-4-1 01:52 PM: 虽然操作有些麻烦还是可以勉强实现的,不过代码多了点而已,唉 [code] @echo off&setlocal for /f "delims=: tokens=1*" %%a in ('findstr /n .* 1.txt') do call ...
Originally posted by huahua0919 at 2008-4-1 14:07: [code] @ECHO OFF findstr /n .* a.txt>>c.txt for /f "delims=: tokens=1" %%i in (c.txt) do set max1=%%i echo.>>c.txt findstr /n .* b.txt>>c.txt for /f "delims=: ...
Originally posted by ansipeter at 2008-4-1 13:52: 虽然操作有些麻烦还是可以勉强实现的,不过代码多了点而已,唉 [code] @echo off&setlocal for /f "delims=: tokens=1*" %%a in ('findstr /n .* 1.txt') do call ...
@ECHO OFF findstr /n .* a.txt>>c.txt for /f "delims=: tokens=1" %%i in (c.txt) do set max1=%%i echo.>>c.txt findstr /n .* b.txt>>c.txt findstr /n .* b.txt>>m.txt for /f "delims=: tokens=1" %%i in (c.txt) do set max2=%%i set /a max=max1-max2 if %max% leq 0 (set/a max=max2) else (set/a max=max1) for /l %%a in (1 1 %max%) do ( findstr %%a: c.txt >>d.txt ) for /f "delims=: tokens=1*" %%a in (d.txt) do ( echo %%b>>e.txt ) del m.txt&&del c.txt&&del d.txt