libloc comes with a command line tool which makes it easy to test the library or integrate it into your shell scripts. location(8) knows a couple of commands to retrieve country or Autonomous System of an IP address and can generate lists of networks to be imported into other software.

Although this is not the fastest way to lookup a large number of IP addresses, location(8) is versatile and very easy to use.

Man Page
CLI
Search for an Autonomous System by Name
$ location search-as "Lightning Wire Labs"
AS204867 (Lightning Wire Labs GmbH)
Lookup an IP Address
$ location lookup 81.3.27.38
81.3.27.38 belongs to 81.3.27.0/24 which is a part of AS24679 (Hostway Deutschland GmbH)