I have imported into a project a bunch of .txt files with single carriage returns at the end of lines and two returns at the end of paragraphs. Now I want to clean these files up so the single returns are replaced by spaces and the doubles by one. (I prefer to control inter-paragraph spacing with careful and precise use of Format > Text > Line and Paragraph Spacing … settings than with crude multiple returns.) However, as you’ll have guessed I cannot find an appropriate find/replace string to match these pesky returns. Ideas?
There are more text editing programs with built-in functions for unwrapping text, for example Text/Remove Line Breaks in the free TextWrangler. But any editor with regular expression support (like Scrivener) can achieve a similar effect with this search pattern:
code\n(?!\s)
[/code]
Replace that with a space to join the lines, then run a second search to replace double-returns with single-returns.
Thanks Amber. Worked a treat.