title: Find a pattern matching a string and send the whole pattern to output
body: <p>I have a file with multiple patterns with below structure:</p>
  
  <pre><code>&lt;DataRecord&gt;
  &lt;TimeStamp&gt;20170620110609-0700&lt;/Timestamp&gt;
  &lt;User&gt;aaaaa&lt;/User&gt;
  &lt;Event&gt;bbbbb&lt;/Event&gt;
  &lt;/DataRecord&gt;
  </code></pre>
  
  <p>Same record or pattern will be repeated many times with different timestamp,user and events.</p>
  
  <p>I'm trying to scan the file and find the patterns with the Event matching the value of ggggg and send it to output , considering that the i need the whole  pattern in the output (like below)</p>
  
  <pre><code>&lt;DataRecord&gt;
  &lt;TimeStamp&gt;20170620110718-0700&lt;/Timestamp&gt;
  &lt;User&gt;hhhhh&lt;/User&gt;
  &lt;Event&gt;gggggg&lt;/Event&gt;
  &lt;/DataRecord&gt;
  </code></pre>
  
  <p>I'm using sed -n '/ggggg/,/DataRecord/p' >> output.txt but it provides the output beginning from <code>&lt;Event&gt;gggggg&lt;/Event&gt;</code> not from <code>&lt;DataRecord&gt;</code> till end of the record.</p>