title: Filtering nmap outputs using grep, awk, or sed
body: <p>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. </p>
  
   <pre class="lang-none prettyprint-override"><code> 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
  </code></pre>
  
  <p>Should output to only output to:</p>
  
  <pre class="lang-none prettyprint-override"><code> 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
  </code></pre>
  
  <p><em><strong>EDIT</em></strong></p>
  
  <p>The results are like</p>
  
  <pre class="lang-none prettyprint-override"><code> 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
  </code></pre>
  
  <p>There are newlines that didn't copy over correctly</p>
  
  <p><strong>EDIT</strong>
  Thanks everyone. I see awk is pretty awesome and easy to do. </p>