You can combine nmap with awk or other shell tools. For example, find out all TCP/22 open ports for the 192.168.2.0/24 CIDR, type:
nmap -oG - -p 22 192.168.2.0/24 | awk -F " " '/open/ {print }'
See my nmap https://www.cyberciti.biz/security/nmap-command-examples-tutorials/ tutorial page for more info.