When I try to use sed for find edit in multiple files, always I 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 does sed use.


It's possible to get a section from a markdown file like

sed -n -e '/^#/,/^#/p'

command. It's possible to put line numbers instead of regexes as well and p at the end is the print command, which can be replaced by, e.g. d to delete the lines.