Reputation: 770
I have a below line in a pom.xml file.
<abc>xyz</abc>
I need to extract xyz by doing a pattern matching using batch script same like sed -e 's/(.*)/\1/'
and the output should be xyz.
Can anyone please help?
Upvotes: 0
Views: 219
Reputation:
You can use <>
as delims.
@for /f "tokens=2delims=>< " %%i in ('type pom.xml') dodo set "result=%%i" & goto :show
:show
echo %result%
or if you want a specific value only based on the property name of the tag..
@for /f "tokens=2delims=>< " %%i in ('type pom.xml ^| find /I "abc"') do set "result=%%i" & goto :show
:show
echo %result%
Upvotes: 1