LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-02-2005, 09:44 AM   #1
latino
Member
 
Registered: Aug 2003
Location: Puerto Rico
Distribution: Centos 6.6
Posts: 142

Rep: Reputation: 15
Script to get City Lat - Log, City Name, Country, etc.


Hi:

I need a cript that could pass a IP list through:
http://www.geobytes.com/IpLocator.htm?GetLocation

and get some data like:

Lat - Lon
City
Country
Population

The most important are: Lat, Log, City and Country.

The question is, IF this is possible to make such a script that could pass the IPs and grab those variables???

TIa


Last edited by latino; 11-02-2005 at 09:46 AM.
 
Old 11-02-2005, 10:18 AM   #2
fvgestel
LQ Newbie
 
Registered: Oct 2005
Location: Netherlands
Posts: 21

Rep: Reputation: 15
try something like this :

#!/bin/bash
while read LINE
do
wget http://www.geobytes.com/IpLocator.ht...ion&ipaddress=$LINE | <grep out the variables>
done

this will read IP-adresses from STDIN, one per line

Greets, Frank
 
Old 11-02-2005, 10:24 AM   #3
latino
Member
 
Registered: Aug 2003
Location: Puerto Rico
Distribution: Centos 6.6
Posts: 142

Original Poster
Rep: Reputation: 15
Hi fvgestel:

Thanks. I am not a programmer altough I have used some bash scirpts before, could you be a little more specific? I have doubt regarding the INPUT and the OUTPUT part.

What is STDIN?

TIA


Last edited by latino; 11-02-2005 at 10:31 AM.
 
Old 11-02-2005, 10:32 AM   #4
fvgestel
LQ Newbie
 
Registered: Oct 2005
Location: Netherlands
Posts: 21

Rep: Reputation: 15
STDIN is standard input. Could be your terminal, could be a file with IP-adresses. eg :

cat <filename> | yourscript.sh

If you run the script without the cat command and pipe, the script will wait for you to type in IP-adresses from the terminal

Greets, Frank
 
Old 11-02-2005, 08:50 PM   #5
latino
Member
 
Registered: Aug 2003
Location: Puerto Rico
Distribution: Centos 6.6
Posts: 142

Original Poster
Rep: Reputation: 15
Hmmm:

No luck here, any other reco or an alternative maybe using Lynx with the script?? After researching, I found that quesrys are limited at 20 per hour. So the script have to follow this restriction....

Thanks


Last edited by latino; 11-02-2005 at 10:03 PM.
 
Old 11-03-2005, 04:49 AM   #6
fvgestel
LQ Newbie
 
Registered: Oct 2005
Location: Netherlands
Posts: 21

Rep: Reputation: 15
Yes, you could also use lynx, using the -dump option
so : lynx -dump http://www.geobytes.com/IpLocator.ht...ion&ipaddress=$LINE
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sim City 3000 Gerardoj Linux - Software 10 07-30-2006 10:20 AM
those country, city list.... javier_ccs Programming 2 07-01-2005 12:35 PM
Greetings from The Windy City mkoljack LinuxQuestions.org Member Intro 1 04-05-2005 02:54 PM
City of Heroes... SHE WORKS GT_Onizuka Linux - Games 1 11-27-2004 10:55 AM
hello from Oklahoma City bobbyduncan LinuxQuestions.org Member Intro 2 04-28-2004 06:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration