Created
February 28, 2012 08:55
-
-
Save johana-star/1931397 to your computer and use it in GitHub Desktop.
Kindle to Markdown v0.0001
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
| # The flaw of this method is it assumes that there will be five lines per highlight/bookmark, | |
| # which will not be the case on multiple paragraph highlights. | |
| NR % 5 == 2 { if ($2) {print "> "$0; token = "true"} else {token = "false"} } | |
| NR % 5 == 0 { if (token == "true") {printf "<div align='right'>–" $0 "</div>\n\n"} } |
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
| #!/bin/bash | |
| cp /Volumes/Kindle/documents/My\ Clippings.txt My\ Clippings.txt | |
| # From awk one-liners, this line reverses the line order of a text file. | |
| awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' My\ Clippings.txt > tmp.txt | |
| # Not sure how to incorporate the awk commands in kindle.awk into this shell script. | |
| awk -f kindle.awk tmp.txt > Quotes.md | |
| rm tmp.txt My\ Clippings.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment