Page 1 of 1

add hyphen between lines

Posted: Fri Dec 23, 2011 2:08 pm
by srive99
Hello,

I have a following data ..
dn: cn=some,ou=orgperson,o=org
changetype: modify
add: attribute
attribute: somevalue
attribute: someother
attribute: somethinglese

dn: cn=some,ou=orgperson,o=org
changetype: modify
add: attribute
attribute: somevalue
attribute: someother
Now I want to add hyphen (-) in between attributes... It should be below.
dn: cn=some,ou=orgperson,o=org
changetype: modify
add: attribute
attribute: somevalue
-
attribute: someother
-
attribute: somethinglese

dn: cn=some,ou=orgperson,o=org
changetype: modify
add: attribute
attribute: somevalue
-
attribute: someother
How can we achieve this with regular expressions.

Thanks a bunch

Posted: Fri Dec 23, 2011 6:02 pm
by kengrubb
This Regex Replace All works, but I have to repeat it to make it work.

Code: Select all

Find what: ^(attribute.*)\n([^-])
Replace with: \1\n-\n\2