这是论坛上的测试题,我原题是这样的
有两个文本如下(实际中并不知道两文本各有多少行):
文本1.txt
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ccccccccccccccccccccccccccccccccccccccc
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
ggggggggggggggggggggggggggggggggggggggg
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
文本2.txt
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
要求用批处理输出如下(两文本交替输出):
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ccccccccccccccccccccccccccccccccccccccc
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
ggggggggggggggggggggggggggggggggggggggg
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz- @echo off
- for /f "delims=" %%i in (1.txt) do set /a n+=1&call,set "_%%n%%=%%i"
- for /f "delims=" %%i in (2.txt) do set /a m+=1&call,set ".%%m%%=%%i"
- if %n% gtr %m% (set "num=%n%") else (set "num=%m%")
- for /l %%i in (1,1,%num%) do (
- if defined _%%i call,echo %%_%%i%%
- if defined .%%i call,echo %%.%%i%%
- )
- pause>nul
复制代码 不知道这个地方的"_%%n%%=%%i" ".%%m%%=%%是什么意思??- . 这个两个符号这里有特殊的含义么????? |