grepcidr is usually available from your distribution's default repositories, so on Debian based systems you could install it with:

sudo apt install grepcidr

Example of grepcidr use:

grepcidr 40.10.32.0/22 /var/log/syslog

You can read more about CIDR notation on the Wikipedia page for CIDR