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

Posted on 2006-05-01
Last Modified: 2013-12-26

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 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 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.
Question by:Globemaster
    LVL 14

    Expert Comment

    This will parse the IP from index.html to stdout:

    sed -e "s/^.*: //" -e "s/<.*$//" index.html
    LVL 51

    Accepted Solution

    wget -q -O -|sed -e 's/.*ess: *\([0-9\.]*\).*/\1/'

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Tab names are off by one 5 48
    fizzArray  challenge 1 28
    FizzBuzz challenge 9 65
    How to convert MFC::CString to UTF8 wchar_t* 10 44
    This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now