I'm needing some #FreeBSD 14.1 sed assistance as my blarg blog script is now failing under FreeBSD.

When this line runs:

echo "$filename" | sed -r 's|\w+/(.*).md|build/\1.html|'

I get this error:

sed: 1: "s|\w+(.*).md|build/\1.h ...": RE error: trailing backslash (\)

I tried removing the \ before the w and the error goes away but the sed line doesn't do anything then ?

It is supposed to change any .md file paths into build/*.html

For example if it gets posts/my-first-freebsd-server.md it should output build/my-first-freebsd-server.html

This worked on #ChimeraLinux and #VoidLinux

I have noticed this but not sure if it's relevant ????

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253893#c11

Any ideas please and thank you ? ❤️

Reply to this note

Please Login to reply.

Discussion

I think I would do something like this:

for file in *.mdbuild; do

newname=$(echo "$file" | sed 's/\.mdbuild$/.html/')

mv "$file" "$newname"

done

Edit as needed for dir paths, etc.