Last active
July 27, 2017 02:44
-
-
Save adam12/d6685a8867825828aa9e67fc17d4d244 to your computer and use it in GitHub Desktop.
Provided list of netblocks on STDIN, count total # of IPs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby -ne 'BEGIN{$n=0}; ~/\/(\d+)/ && $n += (2 ** (32 - $1.to_i)); END{puts $n}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment