Last active
October 24, 2023 13:52
-
-
Save jabranham/31279f60d490b10d101652923706ba19 to your computer and use it in GitHub Desktop.
Evernote to org-mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * 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: | |
| #+BEGIN_SRC sh | |
| for f in *\ * | |
| do | |
| mv "$f" "${f// /-}" | |
| done | |
| #+END_SRC | |
| Remove & symbols: | |
| #+BEGIN_SRC sh | |
| for file in *; do mv "$file" `echo $file | tr '&' 'and'` ; done | |
| #+END_SRC | |
| * Convert to org | |
| You'll need to have the excellent =pandoc= utility installed. | |
| #+BEGIN_SRC sh | |
| for f in *.html | |
| do | |
| pandoc ${f} -f html -t org -o ${f}.org | |
| done | |
| #+END_SRC | |
| Now we rename all the =.html.org= files to just =.org=: | |
| #+BEGIN_SRC sh | |
| for file in *.html.org | |
| do | |
| mv "$file" "${file%%.html.org}.org" | |
| done | |
| #+END_SRC | |
| To get rid of all the HTML tags: | |
| #+BEGIN_SRC sh | |
| perl -i -p0e 's/#\+BEGIN\_HTML.*?#\+END\_HTML/ /sg' *.org | |
| #+END_SRC | |
| And finally, remove all the html files: | |
| #+BEGIN_SRC sh | |
| rm -f *.html | |
| #+END_SRC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment