How can I convert epubs to txt from a (Windows) command line while preserving line breaks?

232 Views Asked by At

I'm trying to convert epubs to txt that preserves line break formatting.

Using the Calibre app itself to convert works fine, but I work with several epubs daily and the process of having to drop the file itself into Calibre, convert, and extract, gets to be extremely time consuming and resource heavy.

The line breaks in the epub files are designated by the following: <p><br/></p>

I've tried using pandoc with:

pandoc -f epub -t plain --wrap preserve -o output.txt input.epub

But this doesn't give me the additional line break.

I've also tried various conversions from epub to markdown to txt as shown:

pandoc -f epub -t markdown --wrap preserve -o output.md input.epub
pandoc -f epub -t markdown+hard_line_breaks --wrap preserve -o output.md input.epub
pandoc -f epub -t markdown+escaped_line_breaks --wrap preserve -o output.md input.epub
pandoc -f markdown -t plain --wrap preserve -o output.txt input.md
pandoc -f markdown+hard_line_breaks -t plain --wrap preserve -o output.txt input.md
pandoc -f markdown+escaped_line_breaks -t plain --wrap preserve -o output.txt input.md

Any help with this would be greatly appreciated!

0

There are 0 best solutions below