Eliminating spaces in imported text

Apologies if this has been answered, or if its so obvious that everyone already knows the answer…

When I import text from another source (e.g. a pdf that I produced using other software) the lines are often broken wherever the source had a line break. Now I have the text copied into scrivener, and I’d like to get rid of all of these breaks. I suppose there is some way of doing this, either with scrivener, or with some service, but I can’t figure it out. Maybe there is something I could do in Textwrangler or another text editor prior to importing into Scrivener?
In consequence, every time I import text I spend ages going through it again eliminating these breaks manually.
Even if the outcome of eliminating extra spaces were to lose paragraph breaks, I wouldn’t mind. It’s quicker to restore paragraph breaks than to reconnect all lines with their previous lines.
Can anybody help me automate the process.




DevonTechnologies offers free Applications and Services on its site:
devon-technologies.com/downl … l#freeware

At a minimum, you need PDF2RTFService and WordService.

After installation, you’ll find them in your Scrivener > Services menu.
Just select the text you want to edit, and then the Services command.

You’ll also want a copy of Service Scrubber (donationware), which lets you edit the Services menu.


Select and copy a linebreak (by dragging the mouse from the end of one line to the beginning of the next). Open the “Find…” window and paste your linebreak into the Find field. In the Replace field, type a single space. Hit “Replace all”.

… although Druid’s reply makes me wonder if I misunderstood the problem.

Excellent! Thanks too for the service scrubber link. That was something else I had wondered how to manage.


By the way, you are right about TextWrangler (which is the way I always clean up text). The command you want is Text>Remove Line Breaks.

If I’m doing it in TextWrangler, Nisus or something like that, I use Find and Replace, first finding 2 consecutive line breaks and replacing them with an @-sign, then I replace single line breaks with a space. Finally I replace @-signs with single line breaks … so my paragraphs are preserved without my having to go through manually.