I am trying to add two new columns to a csv file, that contain the multiplication of the last column to a constant. This last column is formed by the pound symbol and followed by a number.
Input:
id,tester,company,chief,previous_test,test,date,result,cost 6582983b-61d4-4371-912d-bbc76bb8208b,Audrey Feest,Pagac-Gorczany,Claudine Moakson,18/02/2019,Passwords,20/05/2020,none,£11897.96 Expected Output:
id,tester,company,chief,previous_test,test,date,result,cost,euro,dollar 6582983b-61d4-4371-912d-bbc76bb8208b,Audrey Feest,Pagac-Gorczany,Claudine Moakson,18/02/2019,Passwords,20/05/2020,none,¬£11897.96,13682.65€,$16538.16 What I've done so far is take a substring of this column and create another two with it, but all I get is two copies of the last column without the pound symbol:
awk -F, -v OFS="," 'NR==1 { print $0,"euro,dollar"; next } { w = substr($9, 2); u = substr($9, 2); print $0, w, u }' file.csv All I have to do now is multiply those 2 columns by a constant each (1.15 and 1.39 respectively) and add the symbols to each column (€ and $), but I get stuck using the print command at the end.