1
epubcat book.epub 1 3
# outputs plain text of pages 1 through 3

I don’t know if epubs have the concept of “pages.” If not, perhaps we can say each 400 chars are a page? A general solution that works for other ebook formats is better (mobi, azw3, etc).

My own thoughts are currently on first converting the book to text via ebook-convert or pandoc and then extracting the needed amount, but this seems awfully inefficient as I intend to only get a little of the beginning of the content.

You can download an example file that can be used for testing here.

3
  • You can read .epub books with this .jar tool. However, I didn't find any way how to use it in shell script.
    – BlueManCZ
    Apr 10, 2020 at 9:48
  • Can you link us to a file we can use for testing?
    – terdon
    Apr 10, 2020 at 9:59
  • @terdon here: 82.102.11.148:8080//tmp/…
    – HappyFace
    Apr 10, 2020 at 10:42

1 Answer 1

1

You can use mutool:

mutool draw -F text file.epub 1 2>/dev/null

The redirection 2>/dev/null is optional.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .