Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Other formats

Notices

Reply
 
Thread Tools Search this Thread
Old 10-25-2010, 09:33 PM   #1
citac
Fanatic
citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.
 
Posts: 550
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
Removing unnecessary paragraph breaks in .txt

I have a problem I hope someone will help me solve. I have a large number of .txt files, mostly fic saved from various websites. Some of it saved fine, and is displayed correctly on my e-reader, but some of it has a paragraph break at the end of each line.

If I try to remove those extra paragraphs in Word, it removes all paragraphs, and I end up with one big paragraph with no breaks whatsoever. How do I go about removing end-of-line paragraph breaks, and keeping those between paragraphs?
citac is offline   Reply With Quote
Old 10-26-2010, 04:42 AM   #2
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
I guess true paragraph breaks are represented as two consecutive breaks (aka empty line), right?

In that case, you can use something like (without regexp):

Replace all paragraph breaks with "¬" (or some other unused char).
Replace all occurrences of "¬¬" with a paragraph break.
Replace all other occurrences of "¬" with a space.
Jellby is offline   Reply With Quote
Old 10-26-2010, 05:16 PM   #3
citac
Fanatic
citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.citac ought to be getting tired of karma fortunes by now.
 
Posts: 550
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
Quote:
Originally Posted by Jellby View Post
I guess true paragraph breaks are represented as two consecutive breaks (aka empty line), right?

In that case, you can use something like (without regexp):

Replace all paragraph breaks with "¬" (or some other unused char).
Replace all occurrences of "¬¬" with a paragraph break.
Replace all other occurrences of "¬" with a space.
Code:
No, it's text that has short lines, 
a break comes after several words
and is very annoying to read on an
e-reader. There are no extra lines in
between. Sometimes I get this, 
    which is even worse, and 
    has to be taken care of as well.

  Or I get
      this, which looks like coding a text
  like a poem, 
      which is the worst.
See how bad it looks? I tried the above on a .txt file and it worked, thank you! I will have to try it out with various files, but I think the extra spaces shouldn't be hard to remove.

(Um, I totally misread this line "I guess true paragraph breaks are represented as two consecutive breaks (aka empty line), right?". Yes, you're right. I'll leave the above representation as an illustration. )

Last edited by citac; 10-26-2010 at 05:19 PM.
citac is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF to EPUB - spurious paragraph breaks RichieTheK Calibre 2 09-08-2010 11:27 AM
Paragraph breaks thedevilsjester Calibre 2 09-07-2010 12:26 PM
Removing unnecessary line breaks in books. Wintersdark Calibre 17 09-04-2010 04:34 AM
scanned PDF has weird paragraph breaks. Possible to fix lunixer PDF 0 08-30-2010 10:47 PM
Create proper paragraph breaks in ereader2html acj412 Workshop 2 08-10-2009 11:02 PM


All times are GMT -4. The time now is 07:44 PM.


MobileRead.com is a privately owned, operated and funded community.