font matter
Many static site generators, such as hugo, use yaml at the top of markdown
files to provide metadata (author, date, draft status, etc). Front matter begins
with a line containing ---
and ends when a matching line is found. Here's a
neat script I wrote to strip yaml front matter from a directory of markdown
files:
#!/bin/sh
for file in data/*.md; do
sed -i '1 { /^---/ { :a N; /\n---/! ba; d} }' "$file"
tail -n +2 "$file" > "$file.tmp" && mv "$file.tmp" "$file"
done