Skip to content

Instantly share code, notes, and snippets.

@ivanhuay
Created July 5, 2017 12:44
Show Gist options
  • Save ivanhuay/88a76b48feb4661922592a905113c768 to your computer and use it in GitHub Desktop.
Save ivanhuay/88a76b48feb4661922592a905113c768 to your computer and use it in GitHub Desktop.
scrypt for search country of ips files
#!/bin/bash
FILE=$1
if [ -f $FILE ];
then
while read line
do
resp=`curl -s "http://freegeoip.net/json/$line"|grep -Eo "\"country_name\":\"[a-zA-Z\ ]{4,50}\""`
echo "$line $resp"
done <"$FILE"
else
echo "File $FILE does not exist."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment