Hi I am trying to add new columns to an existing csv file and values of the newly added columns will be empty, Consider below as my input csv file,
ID,Start_Date,Maturity_Date
1,23-Aug-24,13-Sep-24
2,23-Aug-24,15-Oct-24
I need to add four new headers "Product_Class,Deal_Code,Settlement_Currency,Valuation_Fixing_Date"
and its values should be empty and my expected output is as below
ID,Start_Date,Maturity_Date,Product_Class,Deal_Code,Settlement_Currency,Valuation_Fixing_Date
1,23-Aug-24,13-Sep-24,,,,,
2,23-Aug-24,15-Oct-24,,,,,
i tried using below awk cmd
sed -i '1s/\r$//' CFG_CALYPSO_NONSD_METREC_06212024.csv
awk 'BEGIN {FS=OFS=","} NR==1 {print $0 ",Product_Class,Deal_Code,Settlement_Currency,Valuation_Fixing_Date"} NR>1 {print $0 ",,,,,"}' CFG_CALYPSO_NONSD_METREC_06212024.csv > temp.csv && mv temp.csv CFG_CALYPSO_NONSD_METREC_06212024.csv
its adding the new headers ,but the empty values of the new headers are getting created in the new line like below
ID,Start_Date,Maturity_Date,Product_Class,Deal_Code,Settlement_Currency,Valuation_Fixing_Date
1,23-Aug-24,13-Sep-24
2,23-Aug-24,15-Oct-24
Can someone suggest me to achieve the requirement as below,
ID,Start_Date,Maturity_Date,Product_Class,Deal_Code,Settlement_Currency,Valuation_Fixing_Date
1,23-Aug-24,13-Sep-24,,,,,
2,23-Aug-24,15-Oct-24,,,,,