2014-03-12 86 views
0

修改列我有以下格式(以逗號分隔)搜索和CSV文件較大

2014.03.11 14:59:59.146,67.1547,67.15507,0.02,0.02 
2014.03.11 14:59:59.206,67.15405,67.15437,0.02,0.02 
2014.03.11 14:59:59.506,67.15552,67.15589,0.02,0.02 
2014.03.11 14:59:59.707,67.15581,67.15616,0.02,0.02 

現在我想完成這個任務,一些大的CSV文件。

  • 多100列2和3

結果應該

2014.03.11 14:59:59.146,6715.47,6715.507,0.02,0.02 
2014.03.11 14:59:59.206,6715.405,6715.437,0.02,0.02 
2014.03.11 14:59:59.506,6715.552,6715.589,0.02,0.02 
2014.03.11 14:59:59.707,6715.581,6715.616,0.02,0.02 

幫助將非常感激。由於

回答

4

awk應該做的:

awk '{$2*=100;$3*=100}1' FS=, OFS=, file 
2014.03.11 14:59:59.146,6715.47,6715.51,0.02,0.02 
2014.03.11 14:59:59.206,6715.4,6715.44,0.02,0.02 
2014.03.11 14:59:59.506,6715.55,6715.59,0.02,0.02 
2014.03.11 14:59:59.707,6715.58,6715.62,0.02,0.02 

您可以使用$2=$2*100或只是$2*=100通過100

+0

乘一列歡迎您,如果答案是你喜歡的東西,請收下,通過選中它旁邊的複選框:) – Jotne

1
perl -F/,/ -lape "$F[$_] *= 100 for (1,2); $_ = join',', @F;" <input.csv> output.csv