If you want to filter the ASN database based on one ASN, follow the instructions below:
Here I am downloading the IP to ASN database.
curl -L https://ipinfo.io/data/free/asn.csv.gz?token=<YOUR_TOKEN> -o asn.csv.gz
I am using the CLI utility
gunzip, but you can use whatever compression software or tool you want to use.
After uncompressing the database, we get the
asn.csv file. Using
grep we will extract the IP data rows for the ASN. We are using the ASN **AS24940.
We will use the
head command to get the CSV column headers. Then we will combine the column headers and output from the
grep command to a
(head -1 asn.csv;grep ",AS24940," asn.csv) > filtered_asn.csv
You can skip the uncompressing step and run grep on the compressed file with
zgrep. Here I am running the grep on the compressed
asn.csv.gz database and viewing it one
zgrep ",AS24940," asn.csv.gz | less