Skip Headers
Oracle® Fusion Middleware Man Page Reference for Oracle Directory Server Enterprise Edition
11g Release 1 (

Part Number E28967-01
Go to Documentation Home
Go to Table of Contents
Go to Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
PDF · Mobi · ePub


reformat LDIF text


 [-h] [-i input.ldif] [-o output.ldif] -c command...


The ldifxform command reformats LDAP Data Interchange Format (LDIF) text, converting between all of the most common character sets, extracting attribute values, modifying attribute names, ordering entries based on attribute values, or giving detailed statistics. In all cases, input LDIF is not changed.


The ldifxform command supports the following options:

-c command

Apply the specified reformatting operation.

The ldifxform command supports the following reformatting operations:

Attribute Modification

The ldifxform command can replace attribute values and remove attribute. To modify attributes, use the following options:

-c suppressoptions

Remove all options other than binary from attribute types.

-c tcut=attribute

Remove the specified attribute from output.

Use this option once for each attribute to remove.

-c tpreserve=attribute

Remove all attributes except the specified attribute from output.

Use this option once for each attribute to retain.

-c treplace=old:new

Replace the old attributes with the new attribute type in output.

Use this option once for each attribute to rename.

Character Set Conversions

The ldifxform command can convert LDIF from one character set to another. To convert character sets, use the following options:

-c to=charSet

Convert to the specified character set to UTF-8.

-c from=charSet

Convert from the specified character set to UTF-8.

The following replacements for charSet are supported on all platforms:


ISO-8859-1 character set

Conversions to this format strip characters not available in the character set.


ASCII character set

Non ASCII characters are replaced with ? when converting to this format.


Windows Unicode Text character set


T.61 character set used by X.500 and LDAP v2 servers

Conversions to this format strip characters not available in the character set.

Additional character sets may be supported for your platform. Use the -h option to display further character sets supported for your platform.

Directory Analysis

The ldifxform command can generate statistical information to help you analyze directory content. To generate statistical information, use the following options:

-c stats

Generate statistical information and append it to the output.

-c statsonly

Generate statistical information instead of other output.

Sorting and Ordering

Many directory servers return search results in the order that entries were loaded into the database. The ldifxform command can sort and order the entries before they are imported into the directory. To sort LDIF, use the following options:

-c order

Sort entries into hierarchical order.

-c sort=attribute

Sort entries in increasing order according to their values for the specified attribute. This is equivalent to alphabetical order for string-valued attributes.

-c sort=^attribute

Sort entries in decreasing order according to their values for the specified attribute. This is equivalent to reverse alphabetical order for string-valued attributes.

-c split=number

Generate the specified number of LDIF files, which can be loaded into the server by multiple clients in parallel. Each output file has a name of the form output_ldifxform_c_n, where


Reflects the file name passed to the -o option


Corresponds to the number of components in the root DN of the LDIF file


The number of the part from 1 to number, inclusive.

Text Transformations

The ldifxform command can perform a number of text transformations affecting the presentation and encoding of the LDIF text. To perform text transformations, use the following options:

-c cleanzero

Remove trailing zero bytes from attribute values.

Use this option when processing LDIF from a buggy encoder.

-c longlines

Do not wrap long lines at the 79th column.

The output can be parsed again, but common tools such as sed and grep on some platforms may not handle lines longer than 1024 characters.

-c nob64

Undo base64 encoding.

The output cannot be parsed again if any attributes have values that are binary or that begin with special characters.

-c nocomments

Remove comments from the output.

-c nodn

Remove DNs from the output.

The output is no longer LDIF.

-c notypes

Remove attribute types from the output.

The output is no longer LDIF.

-c sevenbit

Base64 encode any attribute values containing bytes not present in ASCII.


Display a usage message briefly describing all options.

-i input.ldif

Read input from the file specified.

When this option is omitted, the ldifxform command reads from standard input.

-o output.ldif

Write output to the file specified.

When this option is omitted, the ldifxform command writes to standard output.

Extended Description

The ldifxform command acts as a stream filter, reading input from one file, performing transformations and writing the output to another file. Each transformation is specified by a command parameter to the -c option. Multiple compatible transformations may be performed simultaneously.

Some transformations produce LDIF output destined to be reloaded into a directory. For example, renaming an attribute can be more easily processed on an LDIF file than online through requests to a directory server.

Other transformations do not produce LDIF; they are intended to provide an analysis of directory contents. For example, you may extract all different values of a specific attribute and list them under the DN in which they occur. The statistical operations provide counts of entries and attributes.


The examples in this section use the following conventions:

Example 1   ldifxform: Transforming Search Results to a List

The following command reformats search results into a simple list of employees placed in order by their room number:

$ ldapsearch -h host -b dc=example,dc=com "(uid=*jensen)" | ldifxform \
-c "tpreserve=roomNumber" -c "tpreserve=cn" -c "sort=roomNumber" -c nodn -c notypes
version: 1
#:ordered: TRUE
 Barbara Jensen
 Babs Jensen
 Allison Jensen
 Kurt Jensen
 Richard Jensen
 Gern Jensen
 Ted Jensen
 Jody Jensen
Example 2   ldifxform: Generating Statistical Output

The following command generates statistical output from search results:

$ ldapsearch -h host -b dc=example,dc=com "(uid=*jensen)" | ldifxform -c statsonly
# Basic statistics
#:linecount: 121
#:entrycount: 7
# Number of nonleaf entries (at least one subordinate)
#:nonleafcount: 1
# Number of leaf entries (no subordinates)
#:leafcount: 7
# Largest number of entries immediately below a single nonleaf entry
#:maximmsubr: 7
# Number of levels in the DIT hierarchy
#:maxdepth: 4
# Largest number of AVAs in an RDN forming an entry's DN, normally 1.
#:maxrdns: 1
# Attribute types used in the LDIF file
# e is number entries containing this attr, v is total number of values,
# l is total length, m is max length of any one value, s is general syntax
# and x is extra encoding information.
#:attrstatsinfo: t=description e=1 v=1 l=49 m=49 i=1 s=cis x=ascii
#:attrstatsinfo: t=roomnumber e=7 v=7 l=28 m=4 i=1 s=int
#:attrstatsinfo: t=facsimiletelephonenumber e=7 v=7 l=105 m=15 i=1 s=tel
#:attrstatsinfo: t=telephonenumber e=7 v=7 l=105 m=15 i=1 s=tel
#:attrstatsinfo: t=mail e=7 v=7 l=130 m=19 i=1 s=cis x=mail
#:attrstatsinfo: t=uid e=7 v=7 l=49 m=7 i=1 s=cis x=alphanumeric
#:attrstatsinfo: t=l e=7 v=7 l=71 m=11 i=1 s=cis x=ascii
#:attrstatsinfo: t=ou e=7 v=14 l=144 m=19 i=2 s=cis x=ascii
#:attrstatsinfo: t=objectclass e=7 v=28 l=294 m=20 i=4 s=cis x=alphanumeric
#:attrstatsinfo: t=givenname e=7 v=7 l=36 m=7 i=1 s=cis x=alphanumeric
#:attrstatsinfo: t=sn e=7 v=7 l=42 m=6 i=1 s=cis x=alphanumeric
#:attrstatsinfo: t=cn e=7 v=8 l=96 m=14 i=2 s=cis x=ascii
# Counts of values of specific attribute types
#:attrdomaininfo: t=objectclass v=7 inetOrgPerson
#:attrdomaininfo: t=objectclass v=7 person
#:attrdomaininfo: t=objectclass v=7 top
#:attrdomaininfo: t=objectclass v=7 organizationalPerson

Exit Status

The ldifxform command exits with status 0 if it completes successfully. Otherwise, it exits with non-zero status.


See attributes(5) for descriptions of the following attributes:



Zip distribution only

Stability Level