The reason why RusselB's suggestion doesn't (always) work is that IP addresses aren't always surrounded by spaces in your data: the first and last IPs have a space only on one side.