Hello DOSTips list,
We got a request for one that I am really struggling with:
We get lots of TXT files with user name and passwords, one account per line and some character (often a colon) separating the username and password, such as
jack.thehill@domain.com:jack'spassword
jill.thehill@website.com:jill'spassword
We are needing to get the batch to process it so the original displays, followed by a COMMA, followed by the EMAIL ADDRESS, followed by a COMMA, followed by the PASSWORD
jack.thehill@domain.com:jack'spassword,jack.thehill@domain.com,jack'spassword
jill.thehill@website.com:jill'spassword,jill.thehill@website.com,jill'spassword
Since the files could potentially have different characters that separate the EMAIL ADDRESS from the PASSWORD we will probably just need to SET a variable each time we run it, such as:
set separator=: (or possibly set separator=^:) as I cannot remember if the ":" is a special character.
This really has me scratching my head on how to do this, any advice would be greatly appreciated.
Aisha
Create Two New Columns From Data in Single Column
Moderator: DosItHelp
Re: Create Two New Columns From Data in Single Column
Code: Select all
@ECHO OFF
set "delim=:"
FOR /F "tokens=1,2 delims=%delim%" %%G IN (passwords.txt) DO echo %%G%delim%%%H,%%G,%%H
pause
Code: Select all
jack.thehill@domain.com:jack'spassword,jack.thehill@domain.com,jack'spassword
jill.thehill@website.com:jill'spassword,jill.thehill@website.com,jill'spassword
Re: Create Two New Columns From Data in Single Column
Squashman - thank you
It works beautifully!!!
Aisha
It works beautifully!!!
Aisha