How can I use CSV2LDIF when converting multi-valued attributes from CSV to LDIF format?
search cancel

How can I use CSV2LDIF when converting multi-valued attributes from CSV to LDIF format?

book

Article ID: 52987

calendar_today

Updated On:

Products

CA Directory CA Security Command Center CA Data Protection (DataMinder) CA User Activity Reporting

Issue/Introduction

Description

CSV2LDIF caters for multi-valued attributes within the CSV file. There are some requirements when it comes to formatting the multi-valued attribute data within the CSV file however. Please refer to the solution for further details.

Solution

You can use CSV2LDIF to convert multi-valued attributes from CSV to LDIF format.

  1. In the CSV file, list each value of the multi-valued attributes in separate columns.


  • In the CSV2LDIF template, define each column where your multi-valued attribute exists as separate items. In the example below, we have defined the postalCode multi-valued attribute as existing in columns 15 and 16 of the CSV file.

    # Person (leaf node)
    dn:cn=$4 $5,ou=$2,ou=$1,o=DEMOCORP,c=AU
    objectClass:inetOrgPerson
    cn:$4 $5
    sn:$5
    title:$6 $7
    telephoneNumber:$8 $9
    description:$3
    mail:[email protected]
    postalAddress:$10 $11 $12\$$14 $13
    postalCode:$15
    postalCode:$16

    When we run the CSV2LDIF command:

    csv2ldif -i1 16 democorp.ldt democorp.csv > democorp.ldif

    We see in the LDIF file the two different postalCode values in each LDIF e.g.:

    dn: cn=Nadia KITE,ou=Administration,ou=Corporate,o=DEMOCORP,c=AU
    objectClass: inetOrgPerson
    cn: Nadia KITE
    sn: KITE
    title: Electronics Manager
    telephoneNumber: 204 2857
    description: Clerical
    mail: [email protected]
    postalAddress: 57 Peel Street$St Leonards NSW
    postalCode: 2065
    postalCode: 11111

Environment

Release:
Component: ETRDIR