I have an xml file with IP addresses all over the show. I want to print only the IP addresses and cut off any text before or after the IP address.
Example:
Note: The IP addresses (x.x.x.x) do not consistently appear in the xml file as per the pattern below. Sometimes there are text before and/or after, sometimes there are two, three IP addresses per line.
Computers
blah939
IP Address x.x.x.x
blah3938
IP Address x.x.x.x
blah3938
IP Address x.x.x.x
blah9383
IP Address x.x.x.x
blah3983
IP Address x.x.x.x
thanks! It looks like it did the job. Just after I posted it I found another way with grep. When I count the lines I get more lines with the grep output. Guess it would be difficult to determine without seeing the actual XML output but any ideas for what the reason could be?
Awesome, your script is 99% there. Your script printed 396 lines. I printed the two out again to tmp1 tmp2 and ran them through diff.
Your script printed the following extra line. As you know an IP address cannot end with four characters. I looked at the original xml and it is an incorrect comment added by an administrator.