Previous Topic: ldifdelta Tool—Calculate the Difference Between LDIF Files

Next Topic: Reasons for BAD Records

ldifsort Tool—Sort LDIF Records

Use the ldifsort tool to sort an LDIF file or input stream for the given attribute type.

The tool can sort the LDIF record based on any attribute. By default, the ldifsort tool sorts LDIF records based on their distinguished names. This ensures that each record is followed by its immediate subordinates.

You may opt to sort in descending order. You can use this option, for example, when deleting the entries in an LDIF file from the directory. This sorts the LDIF file on DN in descending order, thus ordering subordinates before superior entries. The LDIF file can then be passed to dxmodify to delete these entries.

Although the default sort is by DN, you may wish to use another attribute, for example, to sort employee records in an LDIF file based on their employee numbers for administration, or based on telephone numbers to allocate spare lines.

The ldifsort tool can cope with bad input records. See the -b option. A record is bad for one of the following reasons:

This command has the following format:

ldifsort [options] infile [outfile]

Example: Make Directories the Same

This example makes the old directory the same as the reference directory:

dxsearch -L -h oldhost "(oc=*)" > old.ldif
dxsearch -L -h referencehost "(oc=*)" > ref.ldif
ldifsort old.ldif old_sorted.ldif
ldifsort ref.ldif ref_sorted.ldif
ldifdelta old_sorted.ldif ref_sorted.ldif | dxmodify -h oldhost


Copyright © 2009 CA. All rights reserved. Email CA about this topic