awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1=(NR>1? substr($9,3)*1.15"€":"euro") $(NF+1)=NR>1=(NR>1? "$"substr($9,3)*1.39 :"dollar") }1' infile Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internalawk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1=(NR>1? substr($9,3)*1.15"€":"euro") $(NF+1)=NR>1=(NR>1? "$"substr($9,3)*1.39 :"dollar") }1' infile awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1? substr($9,3)*1.15"€":"euro" $(NF+1)=NR>1? "$"substr($9,3)*1.39 :"dollar" }1' infile awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=(NR>1? substr($9,3)*1.15"€":"euro") $(NF+1)=(NR>1? "$"substr($9,3)*1.39 :"dollar") }1' infile awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1? substr($9,3)*1.15"€":"euro" $(NF+1)=NR>1? "$"substr($9,3)*1.39 :"dollar" }1' infile Output:Read what is the use of CONVFMT?
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 awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1? substr($9,3)*1.15"€":"euro" $(NF+1)=NR>1? "$"substr($9,3)*1.39 :"dollar" }1' infile 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 awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1? substr($9,3)*1.15"€":"euro" $(NF+1)=NR>1? "$"substr($9,3)*1.39 :"dollar" }1' infile awk 'BEGIN{ FS=OFS=","; CONVFMT="%.2f" } { $(NF+1)=NR>1? substr($9,3)*1.15"€":"euro" $(NF+1)=NR>1? "$"substr($9,3)*1.39 :"dollar" }1' infile 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