My first csv file looks like this: the header is included (the header is only included at the top after each entry):
NAME,SURNAME,AGE
Fred,Krueger,Unknown
.... n records
My second file might look like this:
NAME,MIDDLENAME,SURNAME,AGE
Jason,Noname,Scarry,16
.... n records with this header template
The merged file should look like this:
NAME,SURNAME,AGE,MIDDLENAME
Fred,Krueger,Unknown,
Jason,Scarry,16,Noname
....
In principle, if the headings do not match, all new headings for the headings (columns) should be added after the original heading and their values in accordance with this order.
UPDATE:
Less CSVs have been made above, so I can illustrate what I want to achieve, in reality CSV files are generated one step before (merging) and can contain up to 100 columns
Does anyone know how I can do this? I would appreciate any help