Last active
April 18, 2018 17:16
-
-
Save siriniok/0ae5427b22dc67889a157dd077f3d8a9 to your computer and use it in GitHub Desktop.
Get rid of sed and awk with jq and ruby
This file contains 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
# Shows the number of AWS IPs | |
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[].ip_prefix' | xargs ruby -e "puts ARGV.reduce(0) { |acc, i| acc + 2**(32 - i.split('/')[1].to_i) }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment