title: how do sort items in a text file within its contained time interval
body: <p>I'm writing a bash script that sorts a list on text file, based on a preset time interval on the entry, in this case I have a text file named <code>final.txt</code> , which contains these lines:</p>
  
  <pre><code>14-Oct-2013|04:18|
  14-Oct-2013|04:16|
  14-Oct-2013|04:20|
  14-Oct-2013|05:16|
  14-Oct-2013|06:16|
  </code></pre>
  
  <p>and I'm going to display entries on a text file which is from 04:16 to 05:16, sequentially, chronologically. So it will display like this:</p>
  
  <pre><code>14-Oct-2013|04:18|
  14-Oct-2013|04:16|
  14-Oct-2013|04:20|
  14-Oct-2013|05:16|
  </code></pre>
  
  <p>and the result shouldn't display the last line, since the last line is out of the set time interval (04:16 to 05:16)</p>
  
  <p>and i tried grep for the start time interval, but i don't know what to do to sort entries within the start and the end time interval. i'd like to pipe it to grep again to sort for the end interval time, but, i know, that will display nothing</p>
  
  <p>anyway, here is my code:</p>
  
  <pre><code>cat final.txt | grep $DATE_TO_SORT | sort | grep $HOUR_TO_SORT | sort
  </code></pre>
  
  <p>does anyone here have a solution? it will be appreciated</p>