I am looking for a one-line one which, based on a list of IP addresses, will add the country with which the IP address is based.
So, if I have it like input:
87.229.123.33
98.12.33.46
192.34.55.123
I would like to create this:
87.229.123.33 - GB
98.12.33.46 - DE
192.34.55.123 - US
I already have a script that returns the country for the IP address, but I need to glue it all together with awk until this waht I came up with:
$ get_ips | nawk '{ print $1; system("ip2country " $1) }'
All this is cool, but ip and country are not displayed on the same line, how can I combine the output of the system and ip on the same line?
If you have a better way to do this, I am open to suggestions.
source
share