Skip to content

Instantly share code, notes, and snippets.

@GiacomoLaw
Created January 6, 2017 14:40
Show Gist options
  • Save GiacomoLaw/a9af9197762b5388af8a101db7d47c11 to your computer and use it in GitHub Desktop.
Save GiacomoLaw/a9af9197762b5388af8a101db7d47c11 to your computer and use it in GitHub Desktop.
#Import Google notes to Evernote
#!/bin/bash
# Must be run in the folder containing the desired Google Notes backup
BASE=/tmp/gnotes
rm -Rf $BASE
IFS=$'\n'
for N in `find ./ -maxdepth 1 -mindepth 1 -type d `
do
FOLDER=$N
mkdir -p $BASE/$FOLDER
for SUB in `find $N/ -mindepth 1 -type d`
do
TITLE=`sed 's/.*<p class="note_content">//;s/&ensp;/ /g;s/&quot;/"/g;s/<br>/\n/g;s:</p>.*$::' $SUB/content.html | head -n1`
sed 's/.*<p class="note_content">//;s/&ensp;/ /g;s/&quot;/"/g;s/<br>/\n/g;s:</p>.*$::' $SUB/content.html > $BASE/$FOLDER/$TITLE.txt
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment