Skip to content

Instantly share code, notes, and snippets.

@mbarkhau
Created July 15, 2021 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbarkhau/1606aa3b12286f7c16b44c76d40bb0fd to your computer and use it in GitHub Desktop.
Save mbarkhau/1606aa3b12286f7c16b44c76d40bb0fd to your computer and use it in GitHub Desktop.
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