LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   ldapsearch to csv file (http://www.linuxquestions.org/questions/linux-general-1/ldapsearch-to-csv-file-663458/)

ralinux 08-17-2008 05:52 PM

ldapsearch to csv file
 
HI,

Linux gurus please help me, I am stuck with a problem on how to process the data from ldapsearch.
I am exporting the data from ldap, using ldapsearch for the fields(dn,givenName,department,employeeNumber,employeeID,mail,manager) to user_dump.txt.
But I am getting the output for each field in a row list, instead of comma seperated.
The help I want is, convert the file to csv format.
1) get rid of any # lines
2) put each block as dn,givenName,department,employeeNumber,employeeID,mail,manager in a .csv file
3) I want the file to be imported into a oracle table.

sample output
===============
# Alex Fontana, Users, nbc.com
dn: CN=Ali Fon,CN=Users,DC=nbc,DC=com
givenName: Ali
department: Infrastructure - 19622
employeeNumber: 034636
employeeID: 034636
mail: a...@nbcc.com
manager: CN=Bob Plu,CN=Users,DC=nbc,DC=com

# Aravind Pavu, Users, nbc.com
dn: CN=Aravind Pavu,CN=Users,DC=nbc,DC=com
givenName: Aravind
department: R&D: Performance - 72200
employeeNumber: 035870
employeeID: 035870
mail: ap...@nbcc.com
manager: CN=Raji Kam,CN=Users,DC=nbc,DC=com

Thank you
ra

TB0ne 08-18-2008 12:34 PM

Quote:

Originally Posted by ralinux (Post 3250945)
HI,

Linux gurus please help me, I am stuck with a problem on how to process the data from ldapsearch.
I am exporting the data from ldap, using ldapsearch for the fields(dn,givenName,department,employeeNumber,employeeID,mail,manager) to user_dump.txt.
But I am getting the output for each field in a row list, instead of comma seperated.
The help I want is, convert the file to csv format.
1) get rid of any # lines
2) put each block as dn,givenName,department,employeeNumber,employeeID,mail,manager in a .csv file
3) I want the file to be imported into a oracle table.

Try this, ralinux:

http://www.yolinux.com/TUTORIALS/Lin...sAndTools.html

It specifically addresses exporting LDAP data to a CSV format.


All times are GMT -5. The time now is 06:12 AM.