while read line; do pais=$(whois "$line" | grep -E '[Cc]ountry') echo -n "IP=$line Pais=$pais" && echo done <listaip

geolocalize ip country


0
By: pathcl
2010-10-25 15:39:50

These Might Interest You

  • Provides a cleaner output plus some more details about the IP address. Also, a flaw was corrected where the URL provided the results in Spanish by default. Show Sample Output


    0
    function geoip() { curl -s "http://www.geoiptool.com/en/?IP=$1" | html2text | egrep --color "IP Address:|Country:|City:|Longitude:|Latitude:|Host Name:" }
    JohnQUnknown · 2011-10-25 04:49:25 0
  • This command will help you to get Ip address origin of city and country. I will be happy if someone can shrink the sed command fb.me/josenirmal Show Sample Output


    0
    wget -qO - whatismyipaddress.com/ip/<type ip address> | grep -E "City:|Country:" | sed 's:<tr><th>::'| sed 's</th>::' | sed 's:</td>::' | sed 's:</tr>::' | sed 's:<img*::'
    pentester · 2013-06-21 03:27:09 0
  • If used without arguments, returns own IP info. If used with argument, returns info about the parsed argument. Show Sample Output


    0
    geoip () { curl -s "http://www.geoiptool.com/?IP=$1" | html2text | egrep --color 'City:|IP Address:|Country:' }
    wizel · 2009-11-15 17:59:23 0
  • My first command :) I made this command to log public addresses of a virtual interface who connects random VPN servers around the world. Show Sample Output


    0
    (date "+%d-%m-%Y %H:%M:%S";curl -s --interface lo:1 ifconfig.me| xargs -t geoiplookup 2>&1)|sed -e 's/geoiplookup/IP:/g' -e 's/GeoIP Country Edition/Country/g'|tr -s "\n" " "|sed 'a\ '
    guerito · 2013-10-07 15:28:55 0
  • Change "santa+monica,ca" to your city name and state, or city name and country. In the USA, you can also use your zip code. In other countries, try using your postal code and country code. Show Sample Output


    -1
    curl -s 'http://www.google.com/ig/api?weather=santa+monica,ca'| sed -ne "s/.*temp_c data..//;s/....humidity data.*//;p" | figlet
    monza241 · 2012-06-25 03:58:15 0
  • Use w_scan to build italian DTT video channel list. To change country, substitute IT with 2 letter country code. Userful to be played in vlc by: vlc -f dvb-channels.conf Show Sample Output


    0
    w_scan -X -P -t 2 -E 0 -c IT > dvb-channels.conf
    mrehqe · 2011-11-04 11:17:31 0

What Others Think

It doesn't work for me: while read line; do pais=$(whois "$line" | grep -E '[Cc]ountry') echo -n "IP=$line Pais=$pais" && echo done <listaip > > > ^C
hkbruvold · 394 weeks and 6 days ago
you must have a file 'listaip' which contains IPv4 address
pathcl · 394 weeks and 6 days ago
I didn't understand correctly. Do I have to create a file named "listaip" witch contains the ip-address?
hkbruvold · 394 weeks and 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: