Skip to content

Instantly share code, notes, and snippets.

@shangzongyu
Forked from jabranham/evernote-to-org-mode.org
Created December 27, 2018 06:43
Show Gist options
  • Save shangzongyu/c62b28eda0463f07d55f9d47a2881348 to your computer and use it in GitHub Desktop.
Save shangzongyu/c62b28eda0463f07d55f9d47a2881348 to your computer and use it in GitHub Desktop.
Evernote to org-mode

Export from evernote

You’ll have to open up the evernote application on either Mac or Windows (they don’t have a linux client), right click on the notebook you want to export, and select “Export.” Select the option to export to html (either one page or several pages, depending on your preference. I went with one html page for each note).

Clean filenames

Remove spaces from filenames:

for f in *\ *
do
    mv "$f" "${f// /-}"
done

Remove & symbols:

for file in *; do mv "$file" `echo $file | tr '&' 'and'` ; done

Convert to org

You’ll need to have the excellent pandoc utility installed.

for f in *.html 
do
    pandoc  ${f} -f html -t org -o ${f}.org  
done

Now we rename all the .html.org files to just .org:

for file in *.html.org
do
    mv "$file" "${file%%.html.org}.org"
done

To get rid of all the HTML tags:

perl -i -p0e 's/#\+BEGIN\_HTML.*?#\+END\_HTML/ /sg' *.org

And finally, remove all the html files:

rm -f *.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment