title: unix sort multiple fields
body: <p>I'm trying to sort the file below as follows:</p>
  
  <p>col1 (Ascending) col2 (Descending) col3 (Ascending) col4 (Descending)</p>
  
  <p>I want to use the <code>-k</code> command, not the <code>+-</code> syntax.
  I've figured out how to use the old syntax:</p>
  
  <pre><code>sort -t " " +0 -1 +2 -3 +4r testfile
  </code></pre>
  
  <p>but it's hardly intuitive.
  I haven't figured out the right way to use the <code>-k</code> option. Thank you.</p>
  
  <p>Here's the testfile:</p>
  
  <pre><code>5 3 2 9
  3 4 1 7
  5 2 3 1
  6 1 3 6
  1 2 4 5
  3 1 2 3
  5 2 2 3
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>1 2 4 5
  3 4 1 7
  3 1 2 3
  5 3 2 9
  5 2 2 3
  5 2 3 1
  6 1 3 6
  </code></pre>