求bat批处理删除txt文件中指定的内容
例如a.txt内容为:1233214355465646589843423422334532b.txt内容为12332134532执行完bat后,生成c.txt内容为:43...
例如a.txt内容为:
123
321
435546
564658984
34234223
34532
b.txt内容为
123
321
34532
执行完bat后,生成c.txt
内容为:
435546
564658984
34234223
(a.txt和b.txt内容为纯数字,数字位数不限,每行为一串数字) 展开
123
321
435546
564658984
34234223
34532
b.txt内容为
123
321
34532
执行完bat后,生成c.txt
内容为:
435546
564658984
34234223
(a.txt和b.txt内容为纯数字,数字位数不限,每行为一串数字) 展开
1个回答
2012-05-03
展开全部
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in (b.txt) do (
set/a n+=1
set arr[!n!]=%%i)
for /f "delims=" %%i in (a.txt) do (
for /l %%j in (1,1,!n!) do if "!arr[%%j]!"=="%%i" set flag=exist
if not "!flag!"=="exist" echo %%i>>c.txt
set flag=)
endlocal
setlocal enabledelayedexpansion
for /f "delims=" %%i in (b.txt) do (
set/a n+=1
set arr[!n!]=%%i)
for /f "delims=" %%i in (a.txt) do (
for /l %%j in (1,1,!n!) do if "!arr[%%j]!"=="%%i" set flag=exist
if not "!flag!"=="exist" echo %%i>>c.txt
set flag=)
endlocal
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询