title: Sorting a file by multiple columns using bash sort
body: <p>Here is the file I am working with</p>
  
  <pre><code>word01.2    10  25
  word01.2    30  50
  word01.1    10  30
  word01.1    40  50
  word01.2    40  50
  word01.1    10  20
  word01.1    5   8
  </code></pre>
  
  <p>When I try my sort command</p>
  
  <pre><code>sort -k1,1 -k2,2 -k3,3 file.txt 
  </code></pre>
  
  <p>I receive the following; I don't understand why line 2 and line 1 are not sorted, they should be in reverse positions</p>
  
  <pre><code>word01.1    10  30
  word01.1    10  20
  word01.1    40  50
  word01.1    5   8
  word01.2    10  25
  word01.2    30  50
  word01.2    40  50
  </code></pre>
  
  <p>When I try to add -g to the sort, the sorted file has more problems and column 1 is no longer sorted</p>
  
  <pre><code>sort -k1,1 -gk2,2 -gk3,3 file.txt 
  word01.1    5   8
  word01.1    10  20
  word01.2    10  25
  word01.1    10  30
  word01.2    30  50
  word01.1    40  50
  word01.2    40  50
  </code></pre>
  
  <p>What I would like as results is</p>
  
  <pre><code>word01.1    5   8
  word01.1    10  20
  word01.1    10  30
  word01.1    40  50
  word01.2    10  25
  word01.2    30  50
  word01.2    40  50
  </code></pre>