title: unix sorting, with primary and secondary keys
body: <p>I would like to sort a file on more fields.
  A sample tab separated file is:</p>
  
  <pre><code>a   1   1.0
  b   2   0.1
  c   3   0.3
  a   4   0.001
  c   5   0.5
  a   6   0.01
  b   7   0.01
  a   8   0.35
  b   9   2.3
  c   10  0.1
  c   11  1.0
  b   12  3.1
  a   13  2.1
  </code></pre>
  
  <p>And i would like to have it sorted alphabetically by field 1 (with <code>-d</code>), and when field1 is the same, sort by field 3 (with the <code>-g</code> option).</p>
  
  <p>A didn't succeed in doing this. My attemps were (with a real TAB character instead of <code>&lt;TAB&gt;</code>):</p>
  
  <pre><code>cat tst | sort -t"&lt;TAB&gt;" -k1 -k3n
  cat tst | sort -t"&lt;TAB&gt;" -k1d -k3n
  cat tst | sort -t"&lt;TAB&gt;" -k3n -k1d
  </code></pre>
  
  <p>None of these are working. I'm not sure if sort is even able to do this. I'll write a script for workaround, so I'm just curious whether there is a solution using only <strong>sort</strong>.</p>