title: Is it possible to sort a huge text file using Linux sort command by a number at the end of each line?
body: <p>I am trying to sort a text file where the lines are in the following format:</p>
  
  <pre><code>! ! ! ! ! ||| ! ||| 1.25846e-05 0.248369 3.02708e-07 0.662955 2.718 ||| 0-0 1-0 2-0 3-0 4-0 ||| 476773 1.98211e+07 6
  </code></pre>
  
  <p>and want to sort numerically descending by the number at the end (i.e 6 in this example).  The lines do not have a predicable number of columns using space as a delimiter, but using ||| as a delimiter there are always 5 columns, and the final column always has 3 space delimited numbers, the last of which to sort by.  The text file is around 15gb and I did have a perl script I wrote to do it but it only worked on my old laptop which had 32gb of RAM because perl loads the whole file at once.  Now I am stuck with 8gb RAM and it just churns the swap file for days.  I have heard that the standard linux sort command handles huge files more gracefully but I can't find a way to make it use the number at the end.</p>