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