Skip to content

Instantly share code, notes, and snippets.

@uGeek
Forked from ngoffee/nv2org.sh
Created August 12, 2019 21:51
Show Gist options
  • Save uGeek/e0380b2961286ead26bc6fa227777e96 to your computer and use it in GitHub Desktop.
Save uGeek/e0380b2961286ead26bc6fa227777e96 to your computer and use it in GitHub Desktop.
Convert a directory of Notational Velocity notes to a single Emacs org-mode file
#!/bin/sh
# Convert a directory of Notational Velocity notes to a single file of
# Emacs org-mode notes. Must be run from within the directory to be
# converted. Each entry in the resulting org file will be a 2nd-level
# entry ("** ...") whose title is derived from the filename and whose
# body contains the file contents. Output is written to stdout. '*' at
# the beginning of a line will be converted to '-' to avoid being
# confused with an org-mode headline.
echo "#+STARTUP: content indent hidestars"
echo
for filename in *.txt; do
title=$(echo "${filename%.txt}" | sed \
-e 's,-:,://,g' \
-e 's,:,/,g' \
-e 's,-,:,g')
echo
echo "** ${title}"
echo
sed -E 's,^[*],-,' "${filename}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment