Novell is now a part of Micro Focus

fMakeLDIF - Convert CVS files to LDIF

Novell Cool Solutions: Cool Tool

Digg This - Slashdot This

In Brief

Convert CVS files to LDIF and pipe to ldapmodify IE.


Posted:24 Apr 2006
File Size:6KB
Publisher:Frode Sjovatsen


Please read the note from our friends in legal before using this file.


I often need to modify or add a lot of users and I get the data from some system in cvs format. To quickly convert these data to ldif I wrote this tool. I've only tested it on Windows but it should work on Linux as well. Perl must be installed to make it work since this is a perl script. Type -h to get help:

Usage: -t <template> -a <attrib> [-o <output>] [-s <seperator>] [-h]

-t file   Template file. This file is the template of the LDIF code to be generated. Use *1..*n as variables to be replaces from the attribute file.

-a file   "Something"-separaded file with attributes to be replaced by the variables in the template. Ie.:

                      attrib.txt file
                      template.ldif file
                      dn: cn=*1,ou=users,o=myorg
                      changetype: modify
                      replace: l
                      l: *2

This will generate:

                      dn: cn=user1,ou=users,o=myorg
                      changetype: modify
                      replace: l
                      l: locationA

-o file   The file to write LDIF code to. If not specified it will be written to <STDOUT>.

-s sep   The separator for the attribute file. If not specified ';' will be used. Use tab for \t (tabulator) and space for whitespace.

-h   Prints this help text.

Ie.: -t template.file -a attrib.file -o new.ldif -s tab

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates