grepcidr can be used to filter a list of IP addresses against one or
more Classless Inter-Domain Routing (CIDR) specifications, or arbitrary
networks specified by an address range. As with grep, there are options
to invert matching and load patterns from a file. grepcidr is capable
of comparing thousands or even millions of IPs to networks with little
memory usage and in reasonable computation time.
grepcidr has endless uses in network software, including: mail filtering
and processing, network security, log analysis, and many custom applications.