Skip to content

Instantly share code, notes, and snippets.

@kinshasha
Created May 24, 2017 08:33
Show Gist options
  • Save kinshasha/75f48ec5a81f24ff7e0eacf1fa8e232d to your computer and use it in GitHub Desktop.
Save kinshasha/75f48ec5a81f24ff7e0eacf1fa8e232d to your computer and use it in GitHub Desktop.
BEGIN {
FS="."
ex = "false"
split(address, ip, ".")
}
{
split($0, range, "[-.]")
for (i=1; i<5; i++) {
if (ip[i] < range[i] || ip[i] > range[i+4])
break;
else if ((ip[i] > range[i] && ip[i] < range[i+4]) || i == 4)
ex = "true"
}
}
END {
print ex
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment