Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gnote_export.sh
#!/bin/bash
# sudo apt-get install xml-twig-tools
_source="$HOME/.local/share/gnote"
_dest="$HOME/gnote_export/"
rm -rf "$_dest"
mkdir -p "$_dest"
#_file="simple_desktop_creator.desktop"
#_focus=$_dest$_file
for p in $_source/*.note
do
title=$(xml_grep 'title' "$p" --text_only)
created=$(xml_grep 'create-date' "$p" --text_only | head -c 10)
tags=$(xml_grep 'tags' "$p" --text_only)
f="${_dest}/${created}_${title}.md"
echo "$p -> $f"
xml_grep 'note-content' "$p" --text_only > "$f"
if [[ ! -z ${tags} ]]; then
printf "\n\ntags: ${tags}\n" >> "$f"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment