Oracle® Fusion Middleware Man Page Reference for Oracle Directory Server Enterprise Edition 11g Release 1 (11.1.1.7.0) Part Number E28967-01 |
|
|
PDF · Mobi · ePub |
reformat LDIF text
Synopsis
install-path/dsrk/bin/ldifxform [-h] [-i input.ldif] [-o output.ldif] -c command...
Description
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.
Options
The ldifxform
command supports the following options:
-c
commandApply the specified reformatting operation.
The ldifxform
command supports the following reformatting operations:
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=
attributeRemove the specified attribute from output.
Use this option once for each attribute to remove.
-c
tpreserve=
attributeRemove all attributes except the specified attribute from output.
Use this option once for each attribute to retain.
-c
treplace=
old:
newReplace the old attributes with the new attribute type in output.
Use this option once for each attribute to rename.
The ldifxform
command can convert LDIF from one character set to another. To convert character sets, use the following options:
-c
to=
charSetConvert to the specified character set to UTF-8.
-c
from=
charSetConvert from the specified character set to UTF-8.
The following replacements for charSet are supported on all platforms:
88591
ISO-8859-1 character set
Conversions to this format strip characters not available in the character set.
ascii
ASCII character set
Non ASCII characters are replaced with ?
when converting to this format.
mstxt
Windows Unicode Text character set
t61
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.
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.
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=
attributeSort entries in increasing order according to their values for the specified attribute. This is equivalent to alphabetical order for string-valued attributes.
-c
sort=^
attributeSort 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=
numberGenerate 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.
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.
-h
Display a usage message briefly describing all options.
-i
input.ldifRead input from the file specified.
When this option is omitted, the ldifxform
command reads from standard input.
-o
output.ldifWrite 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.
Examples
The examples in this section use the following conventions:
The ldifxform
command is found in a directory present in the PATH
used for the examples.
The directory server is located on a system named host
.
The directory has been configured to support anonymous access for search and read. Therefore, you do not have to specify bind information.
The directory server listens on port 389, the default for non-SSL connections.
ldifxform
: Transforming Search Results to a ListThe 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 0209 Allison Jensen 0784 Kurt Jensen 1944 Richard Jensen 2631 Gern Jensen 4609 Ted Jensen 4717 Jody Jensen 4882
ldifxform
: Generating Statistical OutputThe 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.
Attributes
See attributes
(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Availability |
Zip distribution only |
Stability Level |
Evolving |