就是有两个文本文档,想合并,但是要第一行对第一行,第二行对第二行
比如第一txt内容是
123
fwi
344
第二个是
fgw
dfe
eee
合并后变成
123fgw
fwidfe
344eee
我现在用的批处理可以实现,但我经常要处理几万甚至几十万行的文本.这个批处理的处理速度太慢了,求高手帮我改快.谢谢!
@echo off & setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt)do (set /a a+=1,b=0
for /f "delims=" %%j in (2.txt)do (set /a b+=1
if !a!==!b! echo %%i%%j>>wind.txt))
::
批处理好慢,求高手改快
答案:2 悬赏:0 手机版
解决时间 2021-03-22 00:27
- 提问者网友:寂寞梧桐
- 2021-03-21 04:16
最佳答案
- 五星知识达人网友:鸠书
- 2021-03-21 05:13
@echo off &setloacl enabledelayedexpansion
set a=0
set b=0
set "file1=1.txt"
set "file2=2.txt"
set "file3=wind.txt"
for /f "delims=" %%a in (%file1%) do (
set /a a+=1
set "a!a!=%%a"
)
for /f "delims=" %%a in (%file2%) do (
set /a b+=1
set "b!b!=%%a"
)
if %a% gtr %b% (
set line=%a%
set "file=%file1%"
) else set "line=%b%"&set "file=%file2%"
for /l %%a in (1,1,%line%) do (
echo !a%%a!!b%%b!
) > "%file3%"
more +%line% "%file%" >> "%file3"
set a=0
set b=0
set "file1=1.txt"
set "file2=2.txt"
set "file3=wind.txt"
for /f "delims=" %%a in (%file1%) do (
set /a a+=1
set "a!a!=%%a"
)
for /f "delims=" %%a in (%file2%) do (
set /a b+=1
set "b!b!=%%a"
)
if %a% gtr %b% (
set line=%a%
set "file=%file1%"
) else set "line=%b%"&set "file=%file2%"
for /l %%a in (1,1,%line%) do (
echo !a%%a!!b%%b!
) > "%file3%"
more +%line% "%file%" >> "%file3"
全部回答
- 1楼网友:纵马山川剑自提
- 2021-03-21 06:03
@echo off
::xtm.dvd-halfcd2.张小五的春天.2010.中国.01集.mkv 改成 张小五的春天第01集.mkv
::改名
for /f "delims=" %%i in ('dir /a-d xtm.dvd-halfcd2.* /b') do (
for /f "tokens=6 delims=." %%j in ('echo %%i') do (
ren "%%i" "张小五的春天第%%j%%~xi"
)
)
echo ok!……&pause>nul
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯