I have this batch script im working on, the point is to extract certain information from an XML and output the results in a text file. I am able to make it work however, I would like my results to come out in rows.
@echo off
setlocal EnableDelayedExpansion
(for /F "delims=" %%a in ('findstr /I /L "<XOrigin> <YOrigin> <XExtent> <YExtent>" grid_crawler_output.xml') do (
set "line=%%a"
set "line=!line:*<XOrigin>=!"
set "line=!line:*<YOrigin>=!"
set "line=!line:*<XExtent>=!"
set "line=!line:*<YExtent>=!"
for /F "delims=<" %%b in ("!line!") do echo %%b
)) > result.txt
My Result is
502800
928000
23650
30750
I would like for it to come out
502800,928000,23650,30750
Any help?
A snip of the source information
- <Projection>
<Mapsheet />
<Projection />
<CentralMeridian>0</CentralMeridian>
<Spheroid />
</Projection>
<MaprecordProjection />
- <CoordinateInfo>
<CoordinateType>Rectangular</CoordinateType>
<GridType>Unrotated</GridType>
<XOrigin>502800</XOrigin>
<YOrigin>928000</YOrigin>
<XExtent>23650</XExtent>
<YExtent>30750</YExtent>
Another block within the XLM file
- <Projection>
<Mapsheet />
<Projection />
<CentralMeridian>200</CentralMeridian>
<Spheroid />
</Projection>
<MaprecordProjection />
- <CoordinateInfo>
<CoordinateType>Rectangular</CoordinateType>
<GridType>Unrotated</GridType>
<XOrigin>114438</XOrigin>
<YOrigin>863252</YOrigin>
<XExtent>534000</XExtent>
<YExtent>404000</YExtent>
</CoordinateInfo>