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.
For Hugo front matter at the beginning of files, it's possible to determine type
but not possible
to set the section.
The latter is the top level directory after content
that contains the file.