Hi,
I need help on how to pivot the data in UNIX. I have one input file in which The facts(FACT1,FACT2..) and PERIOD(JAN,FEB..) are columns.I need to pivot the data. For Exampe The input file and output file looks like below. Could you please help with this using awk
.
INPUT:
======
DTL|MARKET|STORE|PERIOD|FACT1|FACT2|FACT3|FACT4
DTL|101|110752|JAN1709.1|00000.00|12345.67|34567.89|00012.34
DTL|101|120096|JAN1709.1|08934.56|45678.98|67890.23|12367.23
DTL|101|110752|JAN2309.1|00000.00|34562.29|00000.00|00000.00
DTL|112|120096|JAN2309.1|23789.12|00001.00|00003.00|00000.00
OUTPUT:
======
DTL|MARKET|STORE|FACT|JAN1709.1|JAN2309.1
DTL|101|110752|FACT1|00000.00|00000.00
DTL|101|110752|FACT2|12345.67|34562.29
DTL|101|110752|FACT3|34567.89|00000.00
DTL|101|110752|FACT4|00012.34|00000.00
DTL|101|120096|FACT1|08934.56|00000.00
DTL|101|120096|FACT2|45678.98|00000.00
DTL|101|120096|FACT3|67890.23|00000.00
DTL|101|120096|FACT4|12367.23|00000.00
DTL|112|120096|FACT1|00000.00|23789.12
DTL|112|120096|FACT2|00000.00|00001.00
DTL|112|120096|FACT3|00000.00|00003.00
DTL|112|120096|FACT4|00000.00|00000.00