title_body: Clean up converted ebook I have some ebooks which are converted from other formats to ePub. Some are ill-formatted: there are hard line breaks in words and orphaned page numbers between paragraphs.
  
  Example:
  
  
  How can I repair these ebooks? Do I have to open and edit the source files, or is there a better way?
  
  I use Calibre on Windows to organize the ebooks, if that matters, but I am not bound to that program, and I can use Linux too.
upvoted_answer: Somehow I missed that … thanks to Donald.McLean’s answer, I found it.
  
  In the ePub editor, I hit Ctrl+F, and a search &amp; replace tool showed up at the bottom:
  
  
  
  I have used the regex mode and the following patterns:
  
  
  -&lt;/p&gt;\n&lt;p[^&gt;]*&gt; replaced with nothing to remove paragraph breaks within words. I hit Replace all here.
  \s&lt;/p&gt;\n&lt;p[^&gt;]*&gt; replaced with a single space to remove paragraph breaks within sentences. This had to be done manually, unfortunately, because there were some spaces at the end of lines which should stay separated.
  \n&lt;p[^&gt;]*&gt;\d+&lt;/p&gt; replaced with nothing to remove orphaned page numbers. Replace all again.
  
  
  I have also installed, but not yet tested, the plugin Modify ePub by Grant Drake. It offers some automated tasks: