Page 1 of 1
concatenate lines
Posted: Thu Oct 06, 2011 11:55 am
by andrea_baffo
Hi! I have to append multiple lines but these are not consecutive.
BEFORE
AAAA BBBB
1111 11111
2222 22222
5555 55555
AFTER
AAAA BBBB 2222 2222
1111 1111 5555 5555
Thank you so much!!
Posted: Thu Oct 06, 2011 1:23 pm
by ben_josephs
Use "Posix" regular expression syntax:
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Search | Replace... (
<F8>):
Find what: (.*)\n(.*)\n(.*)\n(.*)
Replace with: \1 \3\n\2 \4
[X] Regular expression
Replace All
Posted: Thu Oct 06, 2011 2:36 pm
by andrea_baffo
Thank you so much, It works, you're the best!
And what about if I have three linee to concatenate
BEFORE
First
Fourth
Seventh
Second
Fifth
Eighth
Third
Sixth
Ninth
AFTER
First Second third
Fourth Fifth Sixth
Seventh Eighth ninth
Really Thank you for your time!
Posted: Thu Oct 06, 2011 2:53 pm
by ben_josephs
You could have worked this out yourself.
Find what: (.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)
Replace with: \1 \4 \7\n\2 \5 \8\n\3 \6 \9
[X] Regular expression
Replace All
It won't work beyond
\9 in TextPad.