Advertisement

05.16.2008 at 06:36AM PDT, ID: 23408171
[x]
Attachment Details

use php or perl to convert ldif file to csv

Asked by mcgilljd in PHP Scripting Language, Perl Programming Language

Tags: php,perl

I have attached a sample of what the ldif looks like., it is data in a hierarchical format.  I need to create a csv where each record looks like:

productID,ProductTypeID,expMonth\n

I can use php or perl.  Maybe something like explode in php or split in perl might work.  The ldif file is huge like 20 million lines if that makes a difference.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
dn: expMonth=02Z	 productID=abc1	 productTypeID=xyz	 ocEODDate=20021108	 dc=E
 OD_Data	 dc=App_Entities	 dc=test	dc=com	
objectClass: ocEODContract				
productID: abc1				
ProductTypeID: xyz				
expMonth: 02Z				
openPrice: 1885				
highPrice: 1885				
lowPrice: 1838				
closePrice: 1841				
settlePrice: 1843				
volTot: 16				
volEFP: 0				
openInt: 10				
changeInPrice: -9999999				
blockVolume: -9999999				
 
dn: expMonth=03F	 productID=abc2	 productTypeID=xyz	 ocEODDate=20021108	 dc=E
 OD_Data	 dc=App_Entities	 dc=test	dc=com	
objectClass: ocEODContract				
productID: abc2				
ProductTypeID: xyz				
expMonth: 03F				
openPrice: 1893				
highPrice: 1909				
lowPrice: 1850				
closePrice: 1850				
settlePrice: 1850				
volTot: 22				
volEFP: 0				
openInt: 0				
changeInPrice: -9999999				
blockVolume: -9999999				
 
dn: productID=abc2	 productTypeID=xyz	 ocEODDate=20021108	 dc=EOD_Data	 dc=Ap
 p_Entities	 dc=test	dc=com		
objectClass: ocEODProduct				
productID: abc2				
ProductTypeID: xyz				
description: oil				
alphasortID: S				
volTot: 266				
volEFP: 0				
openInt: 256				
changeInOI: 256				
blockVolume: -9999999				
 
dn: expMonth=02Z	 productID=abc1	 productTypeID=xyz	 ocEODDate=20021108	 dc=E
 OD_Data	 dc=App_Entities	 dc=test	dc=com	
objectClass: abc1				
productID: sample3				
ProductTypeID: xyz				
expMonth: 02Z				
openPrice: 4194				
highPrice: 4250				
lowPrice: 4181				
closePrice: 4211				
settlePrice: 4209				
volTot: 106				
volEFP: 0				
openInt: 106				
changeInPrice: -9999999				
blockVolume: -9999999
[+][-]05.16.2008 at 08:11AM PDT, ID: 21583430

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, Perl Programming Language
Tags: php,perl
Sign Up Now!
Solution Provided By: markpalinux
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628