Created
November 1, 2012 01:11
-
-
Save ngoffee/3990991 to your computer and use it in GitHub Desktop.
Convert a directory of Notational Velocity notes to a single Emacs org-mode file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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