Created
January 28, 2017 01:12
-
-
Save yig/76e87324ca1e9c754e8f28a8ef294dd0 to your computer and use it in GitHub Desktop.
Command line program to get the contents of a Notes.app note
This file contains 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
#!/bin/bash | |
# Author: Yotam Gingold <yotam (strudel) yotamgingold.com> | |
# License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/) | |
# On GitHub as a gist: https://gist.github.com/yig/76e87324ca1e9c754e8f28a8ef294dd0 | |
usage() | |
{ | |
echo 1>&2 "Usage:" "$0" '<Notes.app note name>' | |
exit -1 | |
} | |
if [ $# -ne 1 ] | |
then | |
usage | |
fi | |
## sometimes pandoc generates lots of extra blank lines, but textutil does weird things with lists. | |
osascript -e "tell application \"Notes\" to get body of (first note whose name is \"$1\")" | \ | |
pandoc --from=html --to=plain | |
# textutil -format html -inputencoding UTF-8 -convert txt -stdin -stdout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment