我有一些csv文件,我需要在第4和第5列中总计12%:
原始档案:
Destination,First Interval,Next Interval,First Price,Next Price
93,180,180,4.32210,4.32210,ADD=#60:50&0|SEQ=intNxN@priceN.97%
9370,180,180,4.50000,4.50000,ADD=#60:50&0|SEQ=intNxN@priceN
.50%
9371,180,180,4.50000,4.50000,ADD=#60:50&0|SEQ=intNxN@priceN
.50%
9372,180,180,4.50000,4.50000,ADD=#60:50&0|SEQ=intNxN@priceN
.50%
期望的输出:
Destination,First Interval,Next Interval,First Price,Next Price,Formula
93,180,180,4.84075,4.84075,ADD=#60:50&0|SEQ=intNxN@priceN.97%
9370,180,180,5.04000,5.04000,ADD=#60:50&0|SEQ=intNxN@priceN
.50%
9371,180,180,5.04000,5.04000,ADD=#60:50&0|SEQ=intNxN@priceN
.50%
9372,180,180,5.04000,5.04000,ADD=#60:50&0|SEQ=intNxN@priceN
.50%
通过awk或sed
执行此操作的任何建议答案 0 :(得分:3)
答案 1 :(得分:1)
这可能是使用sed
和awk
sed 's/,/\t/g' file | awk '{print $4+((12/100)*$4), "\t", $5+((12/100)*$5)}'