Find and replace data in text file with data in same file

OK I will do my best to explain what I need help with.

I am trying to format an ldif file so I can import it into Oracle oid.

I need the file to look like this example. Keep in mind there are 3000 of these in the file.

 
changetype: modify
replace: userpassword 
dn: cn=4448322,cn=Users,dc=bennettware,dc=com
userpassword: {SHA}r+uU3mySUIISdVdTDvQxPRLdBFj5w=
-
replace: passwordexpiretime
passwordexpiretime: 20091031112231
-
replace: orclpassword
orclpassword: {x- orcldbpwd}1.0:83sdfdf24977D14AA
 
changetype: modify
replace: userpassword 
dn: cn=213333,cn=Users,dc=bennettware,dc=com
userpassword: {SHA}r+ukljasdfl;kjafdVdTDvQxPRLdBFj5w=
-
replace: passwordexpiretime
passwordexpiretime: 20091031112231
-
replace: orclpassword
orclpassword: {x- orcldbpwd}1.0:835sdff4977D14AA

I have it to this point. Please keep in mind sometimes the userpassword: encrypted pass is in different places in the string of each user. Notice the userpassword: enc pass is not under the dn: line.

changetype: modify
replace: userpassword
dn: cn=418322,cn=Users,dc=bennettware,dc=com
-
replace: orclpassword
userpassword: {SHA}B6UenM9qwerwerews3V5ve8H3H0=
orclpassword: {x- orcldbpwd}1.0:8359A824977D14AA
-
replace: passwordexpiretime
passwordexpiretime: 20091031112231

The long and short is I need to move the "userpassword: encryptep pass" up to directly under the dn field for each record. Is there anyway I can do this with awk or sed or something.

Any help would be greatly appreciated.

Tim

---------- Post updated at 03:28 PM ---------- Previous update was at 09:49 AM ----------

I found a work around.

Thanks for the consideration.

Tim