Hi Friends,
I have a file with a structure like this:
<file1.csv>
field1,field2,field3,field4,field5,field6,field7,field8,field9,field10,field11,field12
Few Salient points on the file's structure
(1)The fields from field1 to field6 is fixed and they would always be present in the file
(2)The field7-field8 is a block and that block of two fields gets repeated variably from three as in the present example ([field7,field8],[field9,field10],[field11,field12]) to any number. There can 10 such instances of these blocks of two fields as well as 20 or even lower down to only 1(wherein you have only field7,field8)
My objective is to create two such files from this file
(1) file1 will have seven fields, the fixed six fields from field1 to field6 and a seventh field with values containing filename and a sequencenumber(unique for each record)
(2) file2 will have the three fields. the first field will contain the filename and the sequencenumber. This is such to tie the records of file2 to file1.
And the other two fields will be for the block of two fields.
So if in the original file we have 3 instances of these blocks, we would have three records in the file for them.
Please help me in this.
regards