title: median of column with awk
body: <p>How can I use AWK to compute the median of a column of numerical data?</p>
  
  <p>I can think of a simple algorithm but I can't seem to program it:</p>
  
  <p>What I have so far is:</p>
  
  <pre><code>sort | awk 'END{print NR}' 
  </code></pre>
  
  <p>And this gives me the number of elements in the column. I'd like to use this to print a certain row <code>(NR/2)</code>. If <code>NR/2</code> is not an integer, then I round up to the nearest integer and that is the median, otherwise I take the average of <code>(NR/2)+1</code> and <code>(NR/2)-1</code>.</p>