View Single Post
Old 12-21-2011, 11:12 AM   #3
damaki
Member
damaki has learned how to buy an e-book online
 
Posts: 11
Karma: 78
Join Date: Jun 2011
Location: Villejuif, France
Device: Kindle 3
By the way, iconv should not be required as I figured out how to add the BOM manually (and that iconv was totally useless for that).

This should be the proper piece of code :
Code:
#!/bin/bash
OUTPUT_FILE='quotes.txt'
SQLITE='./sqlite3.exe'
AWK='awk'

#add the UTF-8 BOM to the generated file
echo -ne '\xEF\xBB\xBF' > $OUTPUT_FILE
$SQLITE Sony_Reader/database/books.db 'select b.author, b.title, a.marked_text FROM annotation a INNER JOIN books b on a.content_id=b._id' | \
$AWK -F '|' '{ print "--------------------\nAuthor: "$1"\nTitle: "$2"\n--------------------\n"$3"\n--------------------" }'| \
unix2dos >> $OUTPUT_FILE
damaki is offline   Reply With Quote