I have a text file which has 4 heading which will constitute the number of columns and based on values an array has to be populated. To give a clear picture it is as:
input text file looks like:
value2 10 11
value3 10 11
and based on the above the output array will look like as
Heading1 Heading2 Heading3 Heading4
value1 10 NULL NULL 10
value2 1011 NULL NULL 10
value3 NULL 1011 NULL NULL
value4 NULL 10 NULL NULL
value5 NULL 11 NULL NULL
value6 NULL 10 10 NULL
value7 NULL 11 11 11
value8 NULL NULL 10 NULL
value9 NULL NULL 11 11
Now suppose under heading one there is some value for value1 then it needs to go in the first column. Same way if heading4 has a value for value1 it needs to go under corresponding column4.
1. Now I am reading the pattern heading and then put the number of columns for the dynamic array.
2. Then I read all the lines and get the number of rows.
3. I read each line but I don't want to read the heading line (I want to ignore that) and then I do a substr and get an array for the unique names of value thing.
But unable to proceed from there...please guide and suggest the logic that can be used.