nmap output only open ports code example Example: nmap output ip only nmap -n -sn 192.0.2.0/24 -oG - | awk '/Up$/{print $2}'