title: Sort PS command by etime
body: <p>So I am trying to develop a script that will find specfic processes, and kill the one that has been running the longest.  Trying to get the command sorted by elapsed time is becoming the issue.  Here is the command i am running, i know there are lots of | and likely a cleaner why to do all this, but I am fairly new to using awk.</p>
  
  <pre><code>ps -eo pid,cmd,stat,etime --sort=etime | grep cassi32 | awk '$3 == "/rESTECH"' | awk '$4 == "S"'
  </code></pre>
  
  <p>and the output i get is this.</p>
  
  <pre><code>5703 cassi32 /rESTECH            S          00:40
  65504 cassi32 /rESTECH            S     1-21:45:39
  65520 cassi32 /rESTECH            S       03:21:39
  65521 cassi32 /rESTECH            S     3-15:02:37
  65531 cassi32 /rESTECH            S     1-21:44:39
  </code></pre>
  
  <p>As you can see the etime column doesnt not appear to be in any particular order, and it is sorting by PID.</p>
  
  <p>Any ideas on how to get this sorted by etime.  once that is finished i can take care of the kill part.</p>