Hi Gurus,
your help was a big help till now but i am in more deep trouble in solving this issue. this time the problem is more complicated.
I am trying to adapt with the above script that Jean and franklin52 wrote .
I have a problem in parsing the below mentioned type of files and obtain the desired output.
Input could be in any form.below are the few samples
Note: the set columns in the file could be in any order. but once the first set is defined in a certain order the rest of the sets will follow the same order of the columns in Input file.
INPUT File
File type1
Header, 4567, USD, SFR, 4568, EUR, SBFR,
Date, LEVEL, NET, TOTAL, MCAP, LEVEL,NET TOTAL MCAP
22-Dec-97, 27.06, 34, 20.92, 11, 26.17, 1, 20.60, 88
23-Dec-97, 27.11, 44, 20.9, 223, 26.50, 2, 20.86, 97
24-Dec-97, 27.17, 2, 21.01, 44, 26.53, 3, 20.89, 54
25-Dec-97, 27.17, 56, 21.02, 55, 26.6, 4, 20.99, 23
26-Dec-97, 27.13, 10, 20.98, 77, 26.55, 5, 20.91, 45
INPUT file Type2
file2
Header,4567,USD,SBFR,4568,EUR,SBCC,4569,JPY,FACT,4570,USD,FACT
Date, LEVEL,TOTAL,LEVEL,TOTAL,LEVEL,TOTAL,LEVEL,TOTAL
22-Dec-97,27.06,20.92,26.17,20.60,26.06,20.92,27.06,20.92
23-Dec-97,27.11,20.96,26.50,20.86,25.06,20.92,21.06,20.92
24-Dec-97,27.17,21.01,26.53,20.89,24.06,20.92,21.06,20.92
25-Dec-97,27.17,21.02,26.66,20.99,23.06,20.92,21.06,20.92
26-Dec-97,27.13,20.98,26.55,20.91,29.06,20.92,21.064,20.92
Input file type 3
file type3
Header,4567,USD,SBFR,4568,EUR,SBCC,4569,JPY,FACT,4570,USD,FACT
Date, NET, TOTAL,NET, TOTAL, NET,TOTAL,NET,TOTAL
22-Dec-97,27.06 20.92,26.17,20.60,26.06,20.92,27.06,20.9289574
23-Dec-97,27.11 20.96,26.50,20.86,25.06,20.92,21.06,20.9289574
24-Dec-97,27.17 21.01,26.53,20.89,24.06,20.92,21.06,20.9289574
25-Dec-97,27.17 21.02,26.66,20.99,23.06,20.92,21.06,20.9289574
file type 4
Header,4567,USD,SBFR,4568,EUR,SBCC,4569,JPY,FACT,4570,USD,FACT
Date, MCAP, TOTAL,MCAP, TOTAL, MCAP,TOTAL,MCAP,TOTAL
22-Dec-97,27.06 20.92,26.17,20.60,26.06,20.92,27.06,20.928
23-Dec-97,27.11 20.96,26.50,20.86,25.06,20.92,21.06,20.925
it can be in any combination but i need to get the out put in the below format
Desired output format for file 4
Date, index_id, currency, index_pro, level, net, total, mcap
22-Dec-97,4567, USD, SBFR, , , 20.92,27.06
22-Dec-97,4568, EUR, SBCC, , , 20.60,26.06
22-Dec-97,4569, JPY, FACT, , , 20.92,26.06
22-Dec-97,4570, USD, FACT, , , 20.928,27.0
23-Dec-97,4567, USD, SBFR, , , 20.96, 27.11
23-Dec-97,4568, EUR, BCC, , , 20.86,26.50
23-Dec-97,4569, JPY, FACT, , , 20.92,25.06
23-Dec-97,4570, USD, FACT, , , 20.925,21.06
I appreciate if you could please help me solve this problem. Your help will be appreciated.
Thanks
VKR