I have many Markdown files with a YAML metadata block at the top:
---
title: title of work
author: author name
author-sort: name, author
published: N
date: XXXX-XX-XX
pub-number: XXXXX
embedded-title: false
---
**title**
a piece of indertimate
length that could be a few lines of many hundreds
---[author name](author link)
---found in [source](source link)
I am trying to find a way to extract the metadata block (so I can feed it into yamllint, but later other things as well). Awk seems like the right tool, but hacking together in awk when I don't understand it, the best I have come up with is this:
awk '/^---$/ {printline = 1; print; next} /^---$/ {printline = 0} printline'
This just shows the whole file, my attempt to limit to the --- lines on their own isn't working (and maybe nothing else here is)!