What's that?

This is a small, fast and memory efficient tool to convert and modify LDIF files.
LDIF is the Lightweight-Directory-Interchange-Format, a file format used with LDAP
database servers (like OpenLDAP or MS ActiveDirectory), familiar to SQL-files.

You can use it to quickly and easily make bulk changes in LDIF files, familiar for
common text files and the sed program. However sed cannot deal with the specialtys
of the LDIF format (base64 encoding and wrapping/folding), so a special program is needed.

Example for what this is useful for:
Consider you have a huge LDIF export from your corporate directory and you want to
import this data into another server. However that server has a different schema
and baseDN as your current one. Lets say, you want to change the baseDN from "dc=example,dc=com" to "dc=example,dc=de" and all "sn" attributes to "surname". This gets easy, just invokeldif-preg_replace.pl 's/dc=example,dc=com/dc=example,dc=de/ig' data.ldif | ldif-preg_replace.pl 's/^sn:/surname/' > result.ldif!

How does it work?

The program reads your LDIF file line by line, applying decoding and unfolding mechanisms on the fly. By doing so, it uses minimal memory - only one attribute value is held at any time. This makes it fast:
a test of the statement above with 1,000,000 entries and two replacements (one normal and one in base64 content) companied by unwrapping took only 26 seconds and used 2.9Kb maximum memory; measured at a Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz.

It is very simple since it runs from command line. Just download it and call it without
parameters. This will give you all options that can be set, or "-h" for more extended help.
Additionally, you can find a more detailed documentation in the release package.

Where can i download ldif-preg-replace?

You can download the latest development version from svn:svn co https://svn.sourceforge.net/svnroot/ldif-preg-replace/ ldif-preg-replace

Or just download the latest file release from the project page at sourceforge!