Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm able to view an epub file in, say, okular, select all the text and copy-paste into a text editor. I'd like a command line method - anyone know of such a thing?

share|improve this question
    
I'd recommend You to use some firefox epub-reading extension instead of an okular. – Adobe Mar 31 '12 at 15:49
up vote 20 down vote accepted

I don't know if Calibre is worth installing for your job, but if you have it you could use the powerful ebook converter:

ebook-convert input.epub output.txt

Output format is deducted from output file extension

I imagine there could be some XML tools/scripts (XSLT) that can transform epub in text as epub is basically XHTML in ZIP archive

share|improve this answer
1  
Calibre (and it's "ebook-convert") is very powerful tool indeed! Thanks! – drevicko Feb 10 '12 at 7:28
    
nice question and nice answer – niccolo m. Aug 21 '12 at 12:28
    
If you've installed calibre on OS X, the command line tool can be found here: /Applications/calibre.app/Contents/MacOS/ebook-convert. – funroll Jan 2 at 18:15

Maybe Calibre can suit your needs?

http://manual.calibre-ebook.com/faq.html#what-formats-does-app-support-conversion-to-from

share|improve this answer
3  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – hhlp Mar 23 '13 at 10:49

An alternative is epub2txt - Extract text from EPUB documents by Kevin Boone, also available on Github.

epub2html is a simple command-line utility for extracting text from EPUB documents and, optionally, re-flowing it to fit a text display of a particular number of columns. It is written entirely in ANSI-standard C.

Usage example:

epub2txt input.epub > output.txt
share|improve this answer

protected by Community Apr 11 '13 at 10:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.