title: Search for text between two time frame using sed
body: <p>I have log files with time stamps. I want to search for text between two time stamps using <code>sed</code> even if the first time stamp or the last time stamp are not present.
  For example, if I search between 9:30 and 9:40 then it should return text even if neither 9:30 nor 9:40 is there but the time stamp is between 9:30 and 9:40.</p>
  <p>I am using a <code>sed</code> one liner:</p>
  <pre><code>sed -n '/7:30:/,/7:35:/p' xyz.log  
  </code></pre>
  <p>But it only returns data if both the time stamps are present; it will print everything if one of the time stamp are missing. And if the time is in 12 hr format it will pull data for both AM and PM.</p>
  <p>Additionally, I have different time stamp formats for different log files so I need a generic command.</p>
  <p>Here are some time format examples:</p>
  <blockquote>
  <pre><code>&lt;Jan 27, 2013 12:57:16 AM MST&gt;
  
  Jan 29, 2013 8:58:12 AM 
  
  2013-01-31 06:44:04,883
  </code></pre>
  </blockquote>
  <p>Some of them contain AM/PM i.e. 12 hr format and others contain 24 hr format so I have to account for that as well.</p>
  <p>I have tried this as well but it doesn't work:</p>
  <blockquote>
  <pre><code>sed -n -e '/^2012-07-19 18:22:48/,/2012-07-23 22:39:52/p' history.log
  </code></pre>
  </blockquote>