Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 06-02-2009, 01:03 AM   #1
Gideon
Wearer of Pants
Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.
 
Gideon's Avatar
 
Posts: 1,050
Karma: 7634
Join Date: Jan 2008
Location: Norman, OK
Device: Amazon Kindle DX / iPhone
Removing Returns, Preserving Paragraphs

Is there anyway to do this easily? (And please be specific if it involves command line stuff, weird knowledge, etc.

I have a document that has hard line returns and I can remove them ALL easily, but this also removes the paragraph returns. Anything I can do to have my cake and eat it to?
Gideon is offline   Reply With Quote
Old 06-02-2009, 02:09 AM   #2
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Use the "Textify" tool which I've posted to the forum several times (a search will find it). Works beautifully.
HarryT is offline   Reply With Quote
Advert
Old 06-02-2009, 02:43 AM   #3
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
To save you looking, it's available here:

https://www.mobileread.com/forums/sho...14&postcount=2

It's a command line tool. Simply open a command prompt, type "textify", and follow the prompts on the screen.
HarryT is offline   Reply With Quote
Old 06-02-2009, 03:21 AM   #4
Gideon
Wearer of Pants
Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.
 
Gideon's Avatar
 
Posts: 1,050
Karma: 7634
Join Date: Jan 2008
Location: Norman, OK
Device: Amazon Kindle DX / iPhone
That didn't work out, unfortunately. But I'll keep it in mind for the future. Maybe other jobs will have more success.
Gideon is offline   Reply With Quote
Old 06-02-2009, 03:24 AM   #5
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Hi Gideon,

In what way did it not work? I use it for all my books which start out as text files, and it's always worked beautifully for me.
HarryT is offline   Reply With Quote
Advert
Old 06-02-2009, 03:32 AM   #6
Gideon
Wearer of Pants
Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.Gideon knows the square root of minus one.
 
Gideon's Avatar
 
Posts: 1,050
Karma: 7634
Join Date: Jan 2008
Location: Norman, OK
Device: Amazon Kindle DX / iPhone
I got some paragraph creation, but mostly it was just huge massive blocks of text like some sort of Henry James nightmare. It just didn't find most the paragraphs.

I tried various settings, none seemed to pull it together. But this is a nasty txt file - every line has a carriage return, paragraphs do not get an extra one.
Gideon is offline   Reply With Quote
Old 06-02-2009, 03:34 AM   #7
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Are you able to post the text file here? If so, I'll be happy to have a play with it myself, and see what I can do for you.
HarryT is offline   Reply With Quote
Old 06-02-2009, 04:28 AM   #8
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Gideon,

I'm not sure what you're looking for in the text tool you're asking about. But if you're using a PC you could check out either of these.

Notepad++ (free, available from sourceforge.net)
Notepad++, designed with programmers in mind, should be able to do any html/xml editing as well as straight text. It can use regular expressions during search & replace. But it doesn't offer much initial support if you're new to regular expressions. Great program, but sometimes their are almost too many options in it - let alone the plugins.

RegexBuddy (commercial software)
RegexBuddy is intended to help you learn regular expressions. Therefore it explains, in english, what the gobblydegook you just typed means - as far as the regex engine is concerned. It allows sample input to see if the output is correct. Must admit that the interface is a bit off-putting.

Barring any of the above, you could always check out Wikipedia, comparison of text editors, for a list of software.
Sabardeyn is offline   Reply With Quote
Old 06-02-2009, 08:07 AM   #9
rogue_ronin
Banned
rogue_ronin has learned how to read e-booksrogue_ronin has learned how to read e-booksrogue_ronin has learned how to read e-booksrogue_ronin has learned how to read e-booksrogue_ronin has learned how to read e-booksrogue_ronin has learned how to read e-booksrogue_ronin has learned how to read e-books
 
Posts: 475
Karma: 796
Join Date: Sep 2008
Location: Honolulu
Device: Nokia 770 (fbreader)
Went looking for an old Windows app I used to use. Has a bit of a strange interface, but it does good things, and has undo (called backout, don't know why.) Saving is weird, too, but once you get the quirks, it works quite well.

Website's gone, but I found it here on MobileRead.

Play around with it, you may find a combination of options that work -- plus it's not command-line, so you can see what's happening immediately.

If your text file has nothing, no deducable marker for paragraphs, you may be out of luck, aside from hand-modding.

m a r

Last edited by rogue_ronin; 06-02-2009 at 08:08 AM. Reason: bad link
rogue_ronin is offline   Reply With Quote
Old 06-02-2009, 08:29 AM   #10
DTM
Intentionally Left Blank
DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.DTM ought to be getting tired of karma fortunes by now.
 
DTM's Avatar
 
Posts: 172
Karma: 300106
Join Date: Feb 2006
Location: Royal Oak, MI, USA
Device: Nook STR
Quote:
Originally Posted by rogue_ronin View Post
...If your text file has nothing, no deducable marker for paragraphs, you may be out of luck, aside from hand-modding.
If you find yourself stuck in that mode, here is a suggestion that may help. In normal text, every paragraph should end with . ! ? " or ). If you replace every return preceded by one of those with double-return, and then eliminate the single returns, it should get you most of the way to what you need. You'll still have to check the whole thing manually, of course, to correct the mid-paragraph lines that happened to end with one of those punctuation characters.

I hope this isn't "War and Peace".
DTM is offline   Reply With Quote
Old 06-02-2009, 09:53 AM   #11
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by Gideon View Post
Is there anyway to do this easily? (And please be specific if it involves command line stuff, weird knowledge, etc.

I have a document that has hard line returns and I can remove them ALL easily, but this also removes the paragraph returns. Anything I can do to have my cake and eat it to?
What is the difference between line returns and paragraph returns in your specific document?

Are paragraphs simply also indented, in addition to being line-broken?

- Ahi
ahi is offline   Reply With Quote
Old 06-02-2009, 02:02 PM   #12
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by ahi View Post
What is the difference between line returns and paragraph returns in your specific document?

Are paragraphs simply also indented, in addition to being line-broken?

- Ahi
Generally this is the case. Sometimes a tab character is used to start the paragraph but the idea is the same. Leading space marks a paragraph boundary rather than a blank line.

Dale
DaleDe is offline   Reply With Quote
Old 06-02-2009, 02:17 PM   #13
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by DaleDe View Post
Generally this is the case. Sometimes a tab character is used to start the paragraph but the idea is the same. Leading space marks a paragraph boundary rather than a blank line.

Dale
Could one then:

1. Replace all instances of "\n " (linebreak + 4 spaces) or "\n\t" (linebreak and tab) with "|" (pipe character).

2. Replace all instances of "\n" (linbreak) with "" (i.e.: nothing).

3. Replace all instances of "|" (pipe character) with "\n\n" (2 linebreaks).

The specifics of how to do this I cannot offer to explain, but perhaps others might... assuming my line of thinking makes sense.

- Ahi
ahi is offline   Reply With Quote
Old 06-02-2009, 02:18 PM   #14
mjh215
Guru
mjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentametermjh215 can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 988
Karma: 12653
Join Date: Apr 2008
Device: None of your business
Quote:
Originally Posted by Gideon View Post
Is there anyway to do this easily? (And please be specific if it involves command line stuff, weird knowledge, etc.

I have a document that has hard line returns and I can remove them ALL easily, but this also removes the paragraph returns. Anything I can do to have my cake and eat it to?
I use a combination of Notepad++ and Word with =X='s BookCreator macro. If you have Word, the BC macro has a word wrap fix to do just what you are asking, amongst other tools that are very helpful. https://www.mobileread.com/forums/showthread.php?t=28313

-MJ
mjh215 is offline   Reply With Quote
Old 06-02-2009, 02:24 PM   #15
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
In vim I'd do something like:

:%s/$/|$
(add a | at every end of line)

:%s/|\n\s\*/\r/g
(replace every | followed by a newline and an arbitrary number of whitespace (at least one) with just a newline)

:%s/|\n/ /g
(replace every | and newline with a space)

Now every paragraph should be a single line (if the source was that simple to begin with).
Jellby is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to reduce indents without "removing space between paragraphs" Skydog Calibre 5 06-05-2010 12:58 AM
removing spacing between paragraphs WITHOUT touching indent? ferossan Calibre 2 12-24-2009 02:12 PM
Removing blank lines between paragraphs? corroonb Workshop 3 08-13-2009 04:23 PM
Removing Line-breaks / Preserving Paragraphs ahi Workshop 5 06-08-2009 02:22 AM
Removing excess carriage returns Halk Calibre 5 05-17-2009 02:35 PM


All times are GMT -4. The time now is 06:50 AM.


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