Command output parser

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
karzer
Posts: 21
Joined: 17 Jul 2010 02:56

Command output parser

#1 Post by karzer » 18 Aug 2010 06:10

Hi,
The command output below the Name line just want to take the next spot

User: Win32_Account.Domain="ader",Name="hasan"
User: Win32_Account.Domain="ader",Name="osman"
User: Win32_Account.Domain="ader",Name="hüseyin"
User: Win32_Account.Domain="ader",Name="ali"

I want to be like that, I wonder how can I do?

Name="hasan"
Name="osman"
Name="hüseyin"
Name="ali"

Thank you

karzer
Posts: 21
Joined: 17 Jul 2010 02:56

Re: Command output parser

#2 Post by karzer » 18 Aug 2010 07:23

Code: Select all

FOR /F "tokens=3 delims=." %%G IN example.txt DO @echo %%G

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Command output parser

#3 Post by aGerman » 18 Aug 2010 08:20

Is the last post your solution?

Otherwise I would suggest to use that:

Code: Select all

FOR /F "tokens=2 delims=," %%G IN example.txt DO @echo %%G


Regards
aGerman

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

Re: Command output parser

#4 Post by ghostmachine4 » 18 Aug 2010 08:38

download gawk for windows , then use this

Code: Select all

c:\test>  gawk.exe -F"," "{print $NF}" file
Name="hasan"
Name="osman"
Name="hüseyin"
Name="ali"


Post Reply