Tool

Frode Sjovatsen's picture
tool
Reads:

5472

Score:
0
0
 
Comments:

1

fMakeLDIF - Convert C V S files to LDIF

Author Info

24 April 2006 - 9:54am
Submitted by: Frode Sjovatsen

license: 
Free

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 makeldif.pl -h to get help:

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

Options:
-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
                     ---------------
                     user1;locationA
                      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.: makeldif.pl -t template.file -a attrib.file -o new.ldif -s tab

Attachmentサイズ
fmakeldif.zip1.79 KB




User Comments

TellierS's picture

Use more than 10 variables

Submitted by TellierS on 7 September 2011 - 4:50am.

Code change to work with >10 variables (line 164):

(-> for ($j = $attribCount; $j >=0; $j--) {)

© 2013 Novell