Skip to content

Instantly share code, notes, and snippets.

@jabranham
Last active October 24, 2023 13:52
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jabranham/31279f60d490b10d101652923706ba19 to your computer and use it in GitHub Desktop.
Save jabranham/31279f60d490b10d101652923706ba19 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