如何使用批处理解决此问题(筛选程序)?

时间:2019-11-09 09:02:28

标签: batch-file cmd

我有一个名为file.txt的文本文件,其中包含

Combo: testing123mail@gmail.com:password
As Combo: 
abcdefghijklmnopqrstuvwxyz@gmail.com:ajfbdf
some text here
some more text here
As Combo: hadvsfhia@ahfjbadj.com:password@1
some random text here
iloveu@gmail.com:passypassyword123
goldenmammy@hotmail.com:youtube123

我正在运行以下代码,仅从上述文本文件mail:pass中过滤file.txt

for /f "tokens=3" %%a in ('type file.txt^|find "As Combo:"') do >>mail.txt echo %%a
for /f "tokens=2" %%b in ('type file.txt^|find "Combo:"') do >>mail.txt echo %%b
for /f "tokens=1" %%c in ('type file.txt^|find ":"') do >>mail.txt echo %%c

mail.txt中的预期输出,

abcdefghijklmnopqrstuvwxyz@gmail.com:ajfbdf
hadvsfhia@ahfjbadj.com:password@1
testing123mail@gmail.com:password
iloveu@gmail.com:passypassyword123
goldenmammy@hotmail.com:youtube123

但是,正在获得实际输出,

abcdefghijklmnopqrstuvwxyz@gmail.com:ajfbdf
hadvsfhia@ahfjbadj.com:password@1
testing123mail@gmail.com:password
Combo:
Combo:
Combo:
As
As
iloveu@gmail.com:passypassyword123
goldenmammy@hotmail.com:youtube123

注意:不同的文本文件中的邮件ID和密码会有所不同。例如,上面给出的邮件ID和密码是我随机输入的。

0 个答案:

没有答案