Appending a parameter value to a .csv file???

Hi

I have a date which I get as parameter. I want it to be added as first column in all the rows in a csv file.

I have tried the below code but no success.

date=$1
awk -F"," '{print $date","$0}' z3.csv > z4.csv

Could you tell the correct code for the above req.?

date=$1
awk -F"," -v d="$date" '{print d","$0}' z3.csv > z4.csv

if you want the , comma after the date, then

date=$1
awk -F"," -v d="$date" '{print d","$0}' z3.csv > z4.csv
1 Like