I using NMAP, I ran a scan on a large network to see open ports. The output file is 2MB, but I want to filter out all of the IP addresses with ALL closed ports.
Nmap scan report for 10.x.x.x
Host is up (0.048s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
23/tcp open telnet
Nmap scan report for 10.x.x.x
Host is up (0.046s latency).
All 1000 scanned ports on 10.x.x.x are closed
Nmap scan report for 10.x.x.x
Host is up (0.045s latency).
All 1000 scanned ports on 10.x.x.x are closed
Should output to only output to:
Nmap scan report for 10.x.x.x
Host is up (0.048s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
23/tcp open telnet
EDIT
The results are like
Nmap scan report for 10.x.x.x
Host is up (0.048s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
23/tcp open telnet
Nmap scan report for 10.x.x.x
Host is up (0.046s latency).
All 1000 scanned ports on 10.x.x.x are closed
Nmap scan report for 10.x.x.x
Host is up (0.045s latency).
All 1000 scanned ports on 10.x.x.x are closed
There are newlines that didn't copy over correctly
EDIT Thanks everyone. I see awk is pretty awesome and easy to do.