Page 1 of 1

Concatenate lines of text omitting blanks lines

Posted: Mon Feb 25, 2008 8:01 pm
by drifus
I have searched the forum and couldn't find exactly what I am looking for.

Before Data:

text
text
text
text
blank line
blank line

After Data:
text text text text
Blank Line
text text text text
Blank Line

The Text Lines can be almost any amount.
The blank lines can also be any amount.

Posted: Mon Feb 25, 2008 8:54 pm
by ben_josephs
Find what: ^(.+)\n(.+)
Replace with: \1 \2

[X] Regular expression

Replace All
Replace All repeatedly until it beeps.

Then
Find what: \n\n
Replace with: \n

[X] Regular expression

Replace All
Replace All repeatedly until it beeps.

These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax

Posted: Mon Feb 25, 2008 8:55 pm
by MudGuard
Replace

Code: Select all

\n([^\n])
(i.e. a line-break followed by something other than a line-break) by

Code: Select all

\1
(i.e the "something other than a line-break)

(in Textpad: Posix Regular Expression Syntax must be checked!)

Posted: Tue Feb 26, 2008 1:25 pm
by drifus
Thank you both, now I am a lot closer to finishing my data manipulation.