![]() |
#1 |
Wearer of Pants
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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? |
![]() |
![]() |
![]() |
#2 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#4 |
Wearer of Pants
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#5 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wearer of Pants
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#7 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#8 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#9 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#10 | |
Intentionally Left Blank
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 172
Karma: 300106
Join Date: Feb 2006
Location: Royal Oak, MI, USA
Device: Nook STR
|
Quote:
I hope this isn't "War and Peace". |
|
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
|
Quote:
Are paragraphs simply also indented, in addition to being line-broken? - Ahi |
|
![]() |
![]() |
![]() |
#12 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
Dale |
|
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
|
Quote:
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 |
|
![]() |
![]() |
![]() |
#14 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 988
Karma: 12653
Join Date: Apr 2008
Device: None of your business
|
Quote:
-MJ |
|
![]() |
![]() |
![]() |
#15 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
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). |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |