I am doing some geoip lookups using the geoiplookup command in Linux. This correctly returns the country codes for me but I need to break them down into continents instead of countries. I currently have a text file full of countries and am trying to determine the best way to convert these to continents using bash. I have a second text file called conversion and it looks like this:
United States:North America
Mexico:North America
Canada:North America
Argentina:South America
Bolivia:South America
Brazil:South America
Chile:South America
etc.
I was thinking of doing some sort of loop for the name in the geo.txt file and grep the conversion.txt file and then print out anything after the :. I highly doubt that is the easiest/best way so just wanted to get a few opinions on it.