cant solve errors in batch script

April 15, 2010 at 23:16:37
Specs: Windows XP

I have a text file which has multiple records each of which look like this:



<Rule>Oracle VICIGMS - Table - VDB2 - 13.5</Rule>

<Date>Fri Jun 26 11:01:06 EST 2009</Date>




Using a batch script, how can I get an output which looks like this:

Table LOTOSIGMS.FU_GAME_DEF_STAGING 5d3bd0c95589e64dd8e8c2a5bf5140dc

I tried the following script:

for /F "tokens=2,3 delims=<>= " %i in (data.txt) do echo %i %j

and the output is as below:


VDB2:vicigms /Node


Fri Jun



I am unable to eliminate lines 2, 3, 4 & 6.

Can some please help.

I am new bee into batch file scripting.

See More: cant solve errors in batch script

Report •

April 16, 2010 at 02:50:47
It may be easier to do that different:

1. look for line holding "Table=", then parse it
2. look for the line holding "MD5=", then parse that

You can use FIND or FINDSTR to only take lines matching a string

Report •

April 16, 2010 at 12:49:22
yeah, to do that findstr is best:
for /F "tokens=2,3 delims=<>= " %i in ('findstr /L /B /i "Table= MD5=" data.txt') do echo %i %j
use FINDSTR /? to view the details how it works.

Report •
Related Solutions

Ask Question