The ldifmodify utility makes changes to the contents of an LDIF file.
ldifmodify options
The ldifmodify utility can be used to make changes to the contents of an LDIF file. Although similar to the ldapmodify tool, the ldifmodify utility does not connect to the directory server but rather operates locally on the LDIF file. The utility also does not accept change information on standard input. It must read all changes from a file.
To make it possible to operate on very large LDIF files with limited amounts of memory, the following limitations will be enforced on the types of changes that can be made:
No modify DNs. Modify DN operations are not supported. Only add, delete, and modify operations will be allowed.
No concurrent modify or delete operations. It is not possible to modify or delete an entry that is to be added during the course of processing.
All options (with the exception of --help and --version) are required. The ldifmodify utility accepts an option in either its short form (for example, -m changeFile) or its long form equivalent (for example, --changesLDIF changeFile).
Specify the path to the file containing the changes to apply. The contents of this file must be in LDIF change format.
Specify the path to the source LDIF file, which contains the data to be updated.
Specify the path to the target LDIF file, which will consist of the data from the source LDIF with all of the specified changes applied.
Display command usage information and exit without attempting to perform any additional processing.
Display the directory server version information and exit rather than attempting to run this command.
The following examples show how to use the directory server commands. You can use the commands on any UNIX, Linux, or Windows system that has at least the Java SE 5 (at least Sun version 1.5.0_08, preferably the latest version of Java SE 6) runtime environment installed on its target system. See Directory Server System Requirements in Sun OpenDS Standard Edition 2.0 Installation Guide for more information.
Suppose that the source file is as follows:
dn: uid=qcubbins,ou=People,dc=example,dc=com objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson uid: qcubbins givenName: Quentin sn: Cubbins cn: Quentin Cubbins mail: qcubbins@example.com userPassword: qcubbins description: This is Quentin's description.
And suppose that the update (change) file is as follows:
## Add new telephone number for Quentin Cubbins dn: uid=qcubbins,ou=People,dc=example,dc=com changetype: modify add: telephoneNumber telephoneNumber: 512-401-1241
The following command updates a source file (-s) with changes listed in a modify file (-m) and outputs to a target file (-t). For Windows platforms, use the file paths for the modify file (for example, -m \temp\update.ldif), the source file (for example, -s \temp\quentin.ldif), and the target file (for example, -s \temp\quentin_updated.ldif):
$ ldifmodify -m /usr/local/update.ldif -s /usr/local/quentin.ldif \ -t /usr/local/quentin_updated.ldif
The updated file is as follows:
dn: uid=qcubbins,ou=People,dc=example,dc=com objectClass: inetOrgPerson objectClass: person objectClass: top objectClass: organizationalPerson sn: Cubbins userPassword: qcubbins description: This is Quentin's description. cn: Quentin Cubbins telephoneNumber: 512-401-1241 givenName: Quentin uid: qcubbins mail: qcubbins@example.com
An exit code of 0 indicates that the operation completed successfully. An exit code of 1 or greater indicates that an error occurred during processing.
UNIX and Linux: install-dir/bin/ldifmodify
Windows:install-dir\bat\ldifmodify.bat