0

I'm working with a .kdf file (making a book for Kindle) and want to extract the text from it because I made changes to it and need to update my .doc file. How to extract the text? An inspection of the file suggests that it is an SQLite database file:

head -c 15 book.kdf # => SQLite format 3

When I run sqlite3 book.kdf, I find no tables, though when I peruse the file with LeSS I recognize parts of the text of the book, albeit in no format I understand.

Is there a way to extract the text?

user4157124
  • 2,809
  • 13
  • 27
  • 42
JellicleCat
  • 28,480
  • 24
  • 109
  • 162
  • How are you seeing if there are any tables or not? – Shawn Sep 04 '19 at 15:48
  • @Shawn : I run `.tables` – JellicleCat Sep 04 '19 at 15:48
  • Hmm. Something might have dropped all tables in the file before you got it and didn't vacuum afterwards. Does `PRAGMA freelist_count` give a non-zero number? – Shawn Sep 04 '19 at 15:54
  • @Shawn : it gives 0 – JellicleCat Sep 04 '19 at 15:57
  • And `PRAGMA page_count`? – Shawn Sep 04 '19 at 16:00
  • @Shawn : whoops. It appears that my answers differ depending on whether I've already run commands like `.dump`. So I've started a new sqlite session, and `PRAGMA freelist_count` gives `12`. `PRAGMA page_count` gives "Error: malformed database schema (?)" – JellicleCat Sep 04 '19 at 16:09
  • 1
    Make sure you're using the latest version of the sqlite3 shell (3.29) and if it still happens the file is probably hosed. The undocumented `.recover` command *might* be able to salvage something. – Shawn Sep 04 '19 at 16:19

0 Answers0