I have a txt file like this. Name 1demo.txt
------
ser principal : Master
Domain : Work
* User : Master
* Domain : Work
* Pass : 1486235a23
* Key: 7e864d8195
* User : Master
* Domain : Work
* AllowKey: 123
* User : Master
* Domain : Work
* AllowKey: 123a
* User : Master
* Domain : Work
* AllowKey: 1abcd
* User : Master
* Domain : Work
* Pass : 1486235a23
* Key : 7e864d8195
* User : Master
* Domain : Work
* AllowKey: 1122
* User : Master
* Domain : Work
* AllowKey: 113344
* User : Master
* Domain : Work
* AllowKey: 1234ff
-------
I have a batch file that parses 1demo.txt and outputs result to 1.txt
1demo.cmd
---------
echo off
for %%A in (1demo.txt) do find "Domain" < %%A >> 1.txt
for %%A in (1demo.txt) do find "Pass" < %%A >> 1.txt
for %%A in (1demo.txt) do find "Key" < %%A >> 1.txt
for %%A in (1demo.txt) do find "AllowKey" < %%A >> 1.txt
----------
but the output is not sequential. I mean its like this.
------------
Domain : Work
* Domain : Work
* Domain : Work
* Domain : Work
* Domain : Work
* Domain : Work
* Domain : Work
* Domain : Work
* Domain : Work
* Pass : 1486235a23
* Pass : 1486235a23
* Key: 7e864d8195
* AllowKey: 123
* AllowKey: 123a
* AllowKey: 1abcd
* Key : 7e864d8195
* AllowKey: 1122
* AllowKey: 113344
* AllowKey: 1234ff
* AllowKey: 123
* AllowKey: 123a
* AllowKey: 1abcd
* AllowKey: 1122
* AllowKey: 113344
* AllowKey: 1234ff
------------
Can you help fix this.
Thanks in advance
Help with dos for loop
Moderator: DosItHelp
Re: Help with dos for loop
Code: Select all
findstr "Domain Pass Key AllowKey" 1demo.txt >>"1.txt"