You are not logged in.
I have a bunch of text documents that I converted from doc format using wv. They all converted fine, but they're now word-wrapped to 80 spaces, making them difficult to edit in a text editor (especially if I want to use "virtual" word wrapping).
Is there any utility that will let me remove the wrapping, without removing *all* line break characters - i.e. still keeping the spacing between paragraphs?
Edit: duh, it just struck me that I could do this with sed. Unfortunately I am not a regex wizard. How could I tell sed to remove all line breaks, *except* for line breaks followed by or following another line break? E.g.
foo.\nBar baz --> line break is removed
foo.\n\nBar baz --> both line breaks are kept
Last edited by Gullible Jones (2011-07-02 19:19:07)
Offline
Hmm, that mostly works... Thanks. Also, how could I reduce the amount of whitespace? e.g. some words are separated by two or more spaces, how can I reduce any chain of spaces to only one space?
Offline
Hmm, that mostly works... Thanks. Also, how could I reduce the amount of whitespace? e.g. some words are separated by two or more spaces, how can I reduce any chain of spaces to only one space?
Have you tried
tr -s ' '
?
Offline
Ah, thanks! I didn't even know that command existed.
Offline