Hello folks,
I have list of ips like
1.1.1.1
2.2.2.2
3.3.3.3
4.4.4.4
whois 1.1.1.1 |grep -E 'country|Country'
it show country=US or whatever.
so i have number of ips in text file, how i can use above script to automate output like
1.1.1.1 US
2.2.2.2 CA
3.3.3.3 FR
---------- Post updated at 09:16 AM ---------- Previous update was at 09:04 AM ----------
#!/bin/sh
while read inputline
do
country=`whois $inputline|grep -E 'country|Country'`
echo $inputline $country
done < /ip.txt
exit 0
i have done it like that, is there any other suggestion
---------- Post updated at 09:22 AM ---------- Previous update was at 09:16 AM ----------
in same file of ips, i have ips with hits like
50 1.1.1.1
40 2.2.2.2
30 3.3.3.3
15 4.4.4.4
how can i see its output like that with above script
IP=1.1.1.1 Country=1.1.1.1 Hits=50
IP=2.2.2.2 Country=2.2.2.2 Hits=40