TIL: sed.
When I try to use sed to find and edit multiple files, I always remember that perl -pe is better suited for this task. Today, this happened again. I tried to find and replace lines starting with # Bla bla with title: Bla bla, and it was easier to use perl -pe 's|^#+ (.*)|title: $1|g' than identifying what kind of regular expressions sed uses.
It’s possible to get a section from a Markdown file with a command like:
sed -n -e '/^#/,/^#/p'
It is also possible to use line numbers instead of regexes. The p at the end is the print command, which can be replaced by, for example, d to delete the lines.