merge lines based on conditions

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
dave maheshwari
Posts: 4
Joined: Wed Feb 08, 2012 6:35 am

merge lines based on conditions

Post by dave maheshwari »

11297 line *&(*&_)(_)()_(_( line ends
line ba bla bla
line ba bla bla
11276 line *&(*&_)(_)()_(_( line ends
98764 line *&(*&_)(_)()_(_( line ends
line again some ba bla bla
I would like to merge all the lines to a single line that does not begin with the 5 numbers
11297 line *&(*&_)(_)()_(_( line ends line ba bla bla line ba bla bla
11276 line *&(*&_)(_)()_(_( line ends
98764 line *&(*&_)(_)()_(_( line ends line again some ba bla bla
I am able to get the first 5 number [0-9][0-9][0-9][0-9][0-9] but not sure how to merge lines when that does not appear ..

any help would be great -- Thanks in advance
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

In TextPad this sort of thing can only be done with clunky methods, like this:

Use "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Search | Replace... (<F8>):
Find what: \n([^0-9]....|.[^0-9]...|..[^0-9]..|...[^0-9].|....[^0-9])
Replace with: _\1 [Replace the underscore with a space]

[X] Regular expression

Replace All
This would be much simpler using a regex with negative look-ahead. But TextPad's regex recogniser doesn't support look-ahead. (WildEdit's recogniser (http://www.textpad.com/products/wildedit/), on the other hand, does.)
dave maheshwari
Posts: 4
Joined: Wed Feb 08, 2012 6:35 am

Post by dave maheshwari »

Awesome ....works like a charm ... thanks a bunch
Post Reply