title: Find specific pattern and print complete text block using awk or sed
body: <p>How can find a specific number in a text block and print the <strong>complete</strong> text block beginning with the key word <code>"BEGIN"</code> and ending with <code>"END"</code>? Basically this is what my file looks like:</p>
  
  <pre><code>BEGIN
  A: abc
  B: 12345
  C: def
  END
  
  BEGIN
  A: xyz
  B: 56789
  C: abc
  END
  
  BEGIN
  A: ghi
  B: 56712
  C: pqr
  END
  
  [...]
  </code></pre>
  
  <p>If I was looking for <code>'^B: 567'</code>, I would like to get this output:</p>
  
  <pre><code>BEGIN
  A: xyz
  B: 56789
  C: abc
  END
  
  BEGIN
  A: ghi
  B: 56712
  C: pqr
  END
  </code></pre>
  
  <p>I could use grep here (<strong><code>grep -E -B2 -A2 "^B: 567" file</code></strong>), but I would like to get a more general solution. I guess <em>awk</em> or <em>sed</em> might be able to do this!?</p>
  
  <p>Thanks! :)</p>