Search code examples
perlactive-directoryldif

unwrap ldifde output file


I'm exporting a schema using ldifde but the output file wraps long lines so it's hard to manually edit with thousand's lines.

I have to edit the file because I must replace a string there, for example:

distinguishedName: 
 CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,-->DC=morel,DC=mis,DC=mo
 r-ambiguit,<--DC=com

to

distinguishedName: 
 CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,-->DC=myDomain,<--DC=com

As you can see I should first unwrap the file and then replace the string, otherwise the replace won't work Any clues on how I should perform that. I tried perl script but not luck. Also I looked into ldifde options.

Thank in advance, m0dest0


Solution

  • If you strictly want to import the schema from one domain to another using LDIFDE, you can use the -c parameter from LDIFDE to change one DN to another, see KB237677: Using LDIFDE to import and export directory objects to Active Directory.

    -c FromDN ToDN  Replace occurrences of FromDN to ToDN