title: How to get the output of top command consistently as a stream?
body: <p>I want to do a little experiment that converts the output of <code>top</code> to a json file over http and then feeds it to a data visualization tool like D3.js.</p>
  
  <p>I could do something like: </p>
  
  <pre><code>top | awk '/Mem/ {print "cpu used: " $2}'
  </code></pre>
  
  <p>and get:</p>
  
  <pre><code>cpu used: 22M
  </code></pre>
  
  <p>but I have to execute the  above command repeatedly to get a data over time.</p>
  
  <p>Is there a way to run top without stopping it, and get a stream of data instead of repeatedly executing it?</p>