I needed to extract an IP address returned from http://www.ipboo.com on one of my CENTOS server so that it could detect if its external IP address had changed.

The HTML file downloaded from the IP reporting site contained the IP address in between a set of <H1></H1> tags so the following extracted the line and then extracts the data between the tags:

#wget www.ipboo.com
#ADDR=`grep h1 index.html | sed -n -e 's/.*<h1>\(.*\)<\/h1>.*/\1/p'`
#echo $ADDR
123.234.42.69
Advertisements