INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Getting 'website' from command line

Getting 'website' from command line

(OP)
Hello,

Looking for some input here. I have a sensor in a server room, and the only way to read it is by pointing a browser at it like:

http://192.168.10.20/index.html?em

The result looks like this:

EN1T;1TC: 24.0HU:39.2%IL 0.4


I am trying to find a way to graph this to get an idea of how the humidity fluctuates. If I could get the result string from a command line, I could redirect it to a file, awk for the 'HU:39.2%' part and append that to a file. From this I would have a historical collection of data I could then graph in excel for example.

But, how do I get the result from a command line? I tried with lynx, but that seems to be interactive, and I would need this to run from a cronjob for example.

Any idea?

RE: Getting 'website' from command line

2
Hi

You can use a downloader ( Wget, curl ), a text-mode browser ( Lynx, Links, ELinks, w3m ) or a networking tool ( Netcat ) :

CODE

curl 'http://192.168.10.20/index.html?em' | sed -n 's/.*HU:\([0-9.]*\)%.*/\1/p' >> /log/file 

Feherke.
feherke.github.io

RE: Getting 'website' from command line

(OP)
Thanks! That works a charm smile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close