• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Getting a value from a Web Page from Linux shell ??

Hello,

Before continuing please excuse my ignorance on this topic because i am relative new to Unix.

I am trying to get my ip-address from http://checkip.dyndns.org through some way in Linux shell. Basically what i want to do is retrieve my ip address that is generated in the index.html file if i browse to that specific site.

I have tried doing a wget http://checkip.dyndns.org and i downloaded the index.html file which contains my correct ip-address inside, but i am not able to retrieve (parse) the html file to get only the IP.

Is there any way you can help me to do this.

Thank you in advance.
0
Globemaster
Asked:
Globemaster
1 Solution
 
sjm_eeCommented:
This will parse the IP from index.html to stdout:

sed -e "s/^.*: //" -e "s/<.*$//" index.html
0
 
ahoffmannCommented:
wget -q -O - http://checkip.dyndns.org|sed -e 's/.*ess: *\([0-9\.]*\).*/\1/'
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now