This shell script converts one or more Trunk Notes files to plain markdown. It removes the first 7 lines and touches the modification date to match the Timestamp line. It does not convert the markdown itself. For example it does not convert ~~ (strikethrough).

It assumes the input files all have the extension .markdown and writes files with extension .md, thus not destroying your original files.

[code lang=text] #!/bin/sh

Converts one or more Trunk Notes to plain markdown

for file in $* ; do basename=$(basename $file .markdown) timestamp=$(egrep ^Timestamp: $file | tr -d “A-Za-z: +-“ | cut -c -14) sed -e ‘1,7d’ < $file > $basename.md touch -t ${timestamp:0:12}.${timestamp:12:14} $basename.md done [/code]

Updated: