Modifying an Entry Using LDIF

cn=Barney Fife,ou=People,dc=example,dc=com

objectClass: inetOrgPerson

cn: Barney Fife

sn: Fife

telephonenumber: 555-1212

telephonenumber: 555-6789

To change the telephone number 555-1212to 555-4321, use the following LDIF update statement:

dn: cn=Barney Fife,ou=People,dc=example,dc=com

changetype: modify

delete: telephonenumber

telephonenumber: 555-1212

-

add: telephonenumber

telephonenumber: 555-4321

The entry is now as follows:

cn=Barney Fife,ou=People,dc=example,dc=com

objectClass: inetOrgPerson

cn: Barney Fife

sn: Fife

telephonenumber: 555-6789

telephonenumber: 555-4321

4.3.3. Deleting All Values of an Attribute Using LDIF

changetype: modify with the delete operation deletes an attribute from an entry. If the entry has more than one instance of the attribute, you must indicate which of the attributes to delete.

For example, the following LDIF update statement deletes all instances of the telephonenumber attribute from the entry, regardless of how many times it appears in the entry:

dn: cn=Barney Fife,ou=People,dc=example,dc=com

changetype: modify

delete: telephonenumber

To delete just a specific instance of the telephonenumber attribute, simply delete that specific attribute value, as described in the next section.

4.3.4. Deleting a Specific Attribute Value Using LDIF

Running changetype: modify with the delete operation can delete a single value for an attribute value from an entry, as well as deleting all instances of the attribute. For example, consider the following entry:

39

Page 59
Image 59
HP UX Red Hat Direry Server Software manual Deleting All Values of an Attribute Using Ldif, Entry is now as follows