grepcidr can be used to filter a list of IP addresses against one or more Classless Inter-Domain Routing (CIDR) specifications. As with grep, there are options to invert matching and load patterns from a file. grepcidr is capable of efficiently processing large numbers of IPs and networks.
Website: http://www.pc-tools.net/unix/grepcidr/
Port: https://github.com/SerenityOS/serenity/tree/master/Ports/grepcidr