Skip to content

Instantly share code, notes, and snippets.

@sdstrowes
Created December 14, 2020 15:34
Show Gist options
  • Save sdstrowes/0f312746916f81da18ad4b0aa5f96113 to your computer and use it in GitHub Desktop.
Save sdstrowes/0f312746916f81da18ad4b0aa5f96113 to your computer and use it in GitHub Desktop.
get inet6num records with assignment-size fields
#!/bin/bash
curl -s https://ftp.ripe.net/ripe/dbase/split/ripe.db.inet6num.gz 2>/dev/null |
gzcat |
awk -F: '
BEGIN {
gotone = false
lines[0] = ""
}
/^$/ {
if (gotone) {
for (l = 0; l < i; l++) {
print lines[l]
}
}
i = 0
gotone = 0
delete lines
}
{
lines[i] = $0
i++
if ($1 == "assignment-size") {
gotone = 1
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment