Joining lines

General questions about using TextPad

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

Post Reply
srive99
Posts: 30
Joined: Fri Apr 16, 2010 1:45 pm

Joining lines

Post by srive99 »

Hi All,

I have an ldif file which is exported from LDAP and its got thousands of lines and some of the DN's are spilted into two lines. How can we can join those lines.

I can do shift J, but since I have thousands of lines that is not good idea.

Here is example of my file
dn: cn=abc,ou=syc,=myorg,o=org
dn: uid=role_ab cd, ou=qaz,ou, edc,
ou=roles,ou=org
dn: cn=abcd,ou=syc,=myorg,o=org
dn: uid=role_ab cd, ou=qaz,ou=edc_
dcf & sync, ou=roles,ou=org
dn: uid=role_ab&sync, ou=qazd,ou=syx -
dcf & sync, ou=roles,ou=org
Thanks[/quote]
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

This is not easy to do with TextPad's regex recogniser because of its limited functionality by the standards of modern tools.

But this should solve your specific problem. It searches for lines whose first character isn't a d or whose second character isn't an n. This is messy and can't readily be genaralised to other similar problems.
Find what: \n([^d]|.[^n])
Replace with: _\1 [Replace the underscore with a space]

[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Post Reply