grepcidr

Filter IP addresses matching IPv4 CIDR/network specifications

brewmacoslinux
Try with needOr install directly
Source

About

Filter IP addresses matching IPv4 CIDR/network specification

Commands

grepcidr

Examples

Filter IPs matching a specific CIDR block from stdin$ echo -e '192.168.1.5\n10.0.0.1\n192.168.1.100' | grepcidr 192.168.1.0/24
Filter IPs from a file matching multiple CIDR ranges$ grepcidr '10.0.0.0/8,172.16.0.0/12' ips.txt
Invert match to find IPs NOT in a CIDR block$ grepcidr -v 192.168.0.0/16 access.log