25 pts.
 How to extract a single word in a text file using a batch command.
I am trying to extract a single word from a file using a batch file. Now i know the findstr command will export the entire string, but i am just look to export a specific word from that string. I have been search for the past 2 days with no luck. The file contains the following lines and i would like export the word jason@jason.com. <<< 100 NO LOGIN jason@jason.com username/password incorrect <<< 100 NO LOGIN jason@jason.com username/password incorrect <<< 100 NO LOGIN jason@jason.com username/password incorrect <<< 100 NO LOGIN jason@jason.com username/password incorrect <<< 100 NO LOGIN jason@jason.com username/password incorrect <<< 100 NO LOGIN jason@jason.com username/password incorrect Thank You.

Software/Hardware used:
Windows server 2008
ASKED: August 17, 2012  3:33 PM
  Help
 Approved Answer - Chosen by JmeloC (Question Asker)

What exactly do you mean by "export" ?  .  Also, please let us know how you decide the word you want to export. Is it always the same word ? or is is always in the same position ?  Or does it follow a pattern ?  Can you post your current code ?

ANSWERED:  Aug 17, 2012  4:32 PM (GMT)  by JmeloC

 
Other Answers:

Some thing like this?
whatever.bat =
Echo off
erase new.txt
for /F “tokens=1,2,3,4,5* delims= ” %%G in (test.txt) do echo %%K >> new.txt

text.txt=
<<< 100 NO LOGIN jason@jason.com username/password incorrect
<<< 100 NO LOGIN jason@jason.com username/password incorrect
<<< 100 NO LOGIN jason@jason.com username/password incorrect
<<< 100 NO LOGIN jason@jason.com username/password incorrect
<<< 100 NO LOGIN jason@jason.com username/password incorrect
<<< 100 NO LOGIN jason@jason.com username/password incorrect

Last Wiki Answer Submitted:  August 19, 2012  5:29 pm  by  JmeloC   25 pts.
Latest Answer Wiki Contributors:  orangehat   1,445 pts.
To see other answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

What i mean by export is locate a single word in a string and export that one word to a text file. word will always change but it will be an email address, so the exported word will be user@domain.com or users5@domain4.com… etc. the reset of the line can be deleted or dropped. I do not have a code and that the problem I just can not find one that will do this.

 25 pts.