I have a large file contents are as shown below :-
Quantity 20589
Quantity 12297
Quantity 100346
Quantity 0
Quantity 141999
Quantity 23662
Quantity 551071
Quantity 72917
Quantity 60460
Quantity 19712
Quantity 35530
Quantity 0
Quantity 29818
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Price 0
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
Discount 100
From this file i want to create a new file which should have data as :-
Quantity,Price,Discount
20589,0,100
12297,0,100
100346,0,100
0,0,100
141999,0,100
23662,0,100
551071,0,100
72917,0,100
60460,0,100
19712,0,100
35530,0,100
0,0,100
29818,0,100
i.e. read the original file, the column name should be the header for the new file and the corresponding values listed as shown above.
Please help me to write a new file using shell script.