title: What is the best way to convert my input text to output in linux shell
body: <p>I am trying to format below text file in linux. could you pls suggest what is the best way to achieve my output.</p>
  
  <p>Input text</p>
  
  <pre><code>Header| Header Identifier
  [2017-02-03 14:23:44,066] - Message 1
  [2017-02-03 14:23:45,066] - Message 1
  [2017-02-03 14:23:46,066] - Message 1
  [2017-02-03 14:23:47,066] - Message 1
  Trailer | Trailer Identifer
  Header| Header Identifier
  [2017-02-03 14:23:44,066] - Message 2
  [2017-02-03 14:23:45,066] - Message 2
  [2017-02-03 14:23:46,066] - Message 2
  [2017-02-03 14:23:47,066] - Message 2
  Trailer | Trailer Identifer
  </code></pre>
  
  <p>Output I am trying to generate</p>
  
  <pre><code>Header| Header Identifier
  [2017-02-03 14:23:44,066] - Message 1
  Trailer | Trailer Identifer
  Header| Header Identifier
  [2017-02-03 14:23:44,066] - Message 2
  Trailer | Trailer Identifer
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>Update : I am not trying to remove duplicates here, I want to keep the record with lowest timestamp and remove others.</p>