title: How can you can calculate the time span between two time entries in a file using a shell script?
body: <p>In a Linux script: I have a file that has two time entries for each message within the file. A 'received time' and a 'source time'. there are hundreds of messages within the file.</p>
  
  <p>I want to calculate the elapsed time between the two times. </p>
  
  <pre><code>2014-07-16T18:40:48Z  (received time)
  2014-07-16T18:38:27Z  (source time)
  </code></pre>
  
  <p>The source time is 3 lines after the received time, not that it matters.  </p>
  
  <p>info on the input data:  </p>
  
  <p>The input has a lines are as follows:  </p>
  
  <pre><code>TimeStamp:        2014-07-16T18:40:48Z  
  </code></pre>
  
  <p>2 lines later: a bunch of messages in one line and within each line, multiple times is:   </p>
  
  <pre><code>sourceTimeStamp="2014-07-16T18:38:27Z"
  </code></pre>