The data being pulled from this.
<IPv4 id="id456F07894780" name="XYZ" comment="stuf123" ro="False" address="1.1.1.1" netmask="255.255.255.255"/>
Here is my PS script.
$input_path = ‘c:\ps\search\fwbuilder.txt’
$output_file = ‘c:\ps\extracted_ip_addresses.txt’
$regex = '((?<=\bname="\b).*?(?=\".comment\b)|(?is)(?<=\baddress="\b).*?(?=\".netmask\b))'
select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $output_file
I want the display to be like this.
XYZ 1.1.1.1
But instead it is showing up as
XYZ
1.1.1.1 EDIT*************
I was able to accomplish what I needed using the XML parser in PS.
Get-Content -Path C:\ps\search\network.xml | Select-Xml -XPath //Network | Select-object -ExpandProperty "node" | Select-object "name","address","netmask","id"
Thanks for the help.