I've a tab seperated source file with this structure: Only the first 9 columns from ID to Line Item/Property is fixed, rest are all dynamic varying in count and structure.
ID Date/Time (UTC) User Description Security Change Previous Value New Value Module/List Line Item/Property Scenarios Region EM2 Plan Item PB6 Market EM4 Plants - Master Plan Brand PB4 T/DI GRS 6 GRS 7 Target User Import Object Target Role Export Dashboard Action Time
Here's one sample record from that file
2572561 3/24/2020 14:01 [email protected] FALSE TRUE FILTER: Brand P&L Report - Market Plan Brands Polly Pocket [email protected]
I need to change it to the below struture as a CSV file with the following headers and data format using Unix shell script. I want to keep the permanent columns (ID till Line Item/Property) as such and park all other dynamically variable columns into Attribute Name & Attribute Value column:
ID,Date/Time (UTC),User,Description,Security Change,Previous Value,New Value,Module/List,Line Item/Property,Attribute Name,Attribute Value
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Scenarios,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Region EM2,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Plan Item PB6,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Market EM4,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Plants - Master,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Plan Brand PB4,Polly Pocket
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,T/DI,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,GRS 6,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,GRS 7,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Target User,[email protected]
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Import,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Object,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Target Role,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Export,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Dashboard,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Action,
2572561,3/24/2020 14:01,[email protected],,,FALSE,TRUE,FILTER: Brand P&L Report - Market,Plan Brands,Time,
,) in original data records.