Extracting the IP address or Domain Name can be done with one egrep.