Advertisement
n8henrie

Kindle Quotes Regex

Jan 3rd, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.39 KB | None | 0 0
  1. #!/bin/bash
  2. #relevant post found here: http://n8henrie.com/2013/01/regex-shell-script-to-format-kindle-quotes
  3. 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"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement