title: How can I extract a YAML block using AWK
body: <p>I want to use AWK to extract the '---'-delimited YAML block from a file like the following:</p>
  <pre><code>---
  title: &quot;This is a title&quot;
  sourceEditionDate: 1927-01-01
  languages:
    - &quot;latin&quot;
  tags:
    - poetry
  ---
  
  Some other text I do not want to extract
  
  </code></pre>
  <p>with the following result:</p>
  <pre><code>title: &quot;This is a title&quot;
  sourceEditionDate: 1927-01-01
  languages:
    - &quot;latin&quot;
  tags:
    - poetry
  </code></pre>
  <p>So far I have tried this approach</p>
  <pre><code>awk '/---/{p=0};p;/---/{p=1}' file
  </code></pre>
  <p>but I still get the entire file including the unwanted last line.</p>