strip a substring from a messy search result
Posted: 06 Jul 2009 15:13
I am trying to get a clean output from findstr (other suggestions are welcome).
If I run the comand:
I get the following output:
I would like to some how have a batch file that returns the output like this:
I have tried various loops that help separate the line number from the rest of the text but I can not figure out how to separate the specific text (softVersion="SomeValueHere") from the rest of the output.
Any help is appreciated.
Thanks,
Joshua
here is the content of the text.xoml file:
If I run the comand:
Code: Select all
findstr /n SoftVersion Test.xoml
I get the following output:
Code: Select all
8: <ns3:TestAndImproveSharpness x:Name="testAndImpr
oveSharpness1" ImageSharpessWithinThreshold="False" SoftVersion="TestFramew
ork" SettingsFile="{ActivityBind SliceAndViewRecipe,Path=Parameters.ImagingSetti
ngs.SweepAutoFocusConfigurationFileName}" ImageGrabSettings="{ActivityBind Slice
AndViewRecipe,Path=Parameters.AcquireImageParameters.ElectronBeamSemImageSetting
}" Description="Test and Improve Image Sharpness" SharpnessThreshold="{ActivityB
ind SliceAndViewRecipe,Path=Parameters.ImagingSettings.SharpnessThreshold}" />
I would like to some how have a batch file that returns the output like this:
Code: Select all
8: SoftVersion="TestFramework"
I have tried various loops that help separate the line number from the rest of the text but I can not figure out how to separate the specific text (softVersion="SomeValueHere") from the rest of the output.
Any help is appreciated.
Thanks,
Joshua
here is the content of the text.xoml file:
Code: Select all
<ns0:SliceAndViewRecipeBase x:Name="sample" >
<ns2:ForEachSliceActivity NumberOfSlices="{ActivityBind SliceAndViewRecipe,Path=Parameters.NumberOfSlices}" SliceAndViewVolume="{ActivityBind SliceAndViewRecipe,Path=Parameters.MillingDefinitions.SliceAndViewMillingParameters.SliceAndViewBox}" x:Name="forEachSlice" Description="A generic flow control activity that executes once for each slice." StartSliceIndex="{ActivityBind SliceAndViewRecipe,Path=Parameters.InitialSliceNumber}">
<ns2:HiddenSequenceActivity x:Name="sequence_ForEachSliceActivity">
<IfElseBranchActivity x:Name="ifElseBranchActivity6">
<IfElseBranchActivity.Condition>
<RuleConditionReference ConditionName="CheckImageSharpness" />
</IfElseBranchActivity.Condition>
<ns3:TestAndImproveSharpness x:Name="testAndImproveSharpness1" ImageSharpessWithinThreshold="False" SoftVersion="TestFramework" SettingsFile="{ActivityBind SliceAndViewRecipe,Path=Parameters.ImagingSettings.SweepAutoFocusConfigurationFileName}" ImageGrabSettings="{ActivityBind SliceAndViewRecipe,Path=Parameters.AcquireImageParameters.ElectronBeamSemImageSetting}" Description="Test and Improve Image Sharpness" SharpnessThreshold="{ActivityBind SliceAndViewRecipe,Path=Parameters.ImagingSettings.SharpnessThreshold}" />
</IfElseBranchActivity>
</ns2:HiddenSequenceActivity>
</ns2:ForEachSliceActivity>
</ns0:SliceAndViewRecipeBase>