This works for the ASN API.
curl -sL ipinfo.io/AS62240?token=$token | jq -r '.prefixes[].netblock, .prefixes6[].netblock'
curlis used for making the get request.-sLis not necessary here, butsis for silent mode andLis for redirect. I just use it out of force of habit.ipinfo.io/AS62240?token=$tokenis the ASN API lookup endpoint. Please note that this API is not free.jqis a JSON wrangling CLI app.-ris for raw strings, removing the double quotes from the JSON values.'.prefixes[].netblock, .prefixes6[].netblock'is a JSON query parameter that extracts the netblock value from theprefixes(IPv4) andprefixes6(IPv6) arrays containing objects.
