Skip to content

Instantly share code, notes, and snippets.

@n8henrie
Created March 17, 2013 16:42
Show Gist options
  • Save n8henrie/5182369 to your computer and use it in GitHub Desktop.
Save n8henrie/5182369 to your computer and use it in GitHub Desktop.
#!/bin/bash
#relevant post found here: http://n8henrie.com/2013/01/regex-shell-script-to-format-kindle-quotes
tr -s '\r\n' '\t' < "$1" | perl -pe 's|(==========)|\n|g' | grep -Po "\S.*?Highlight\ Loc\.\ .*?$" | perl -pe 's/(.*?)\t- Highlight Loc. .*? (Added on .*?), \d\d:\d\d (A|P)M\t(.*?)\t$/<blockquote>\4<\/blockquote><p>-\1, \2<\/p>\n/g' >"/Users/[username]/Desktop/KindleQuotesFormatted.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment