将文件的每个字段相乘

时间:2016-03-31 15:03:52

标签: bash

我必须制作一个bash脚本,将每个第一个文件字段乘以10。

示例(number.csv):

"1","0","Test1","2016-03-31 15:34:50",\N,\N,"2016-03-31 15:34:58","2","2","2","1","test","3","3","3","0","1","0",\N,"1","0","0",\N,\N,"0","0","0","0","8","0","0","0","0"
"2","0","Test1","2016-03-31 15:34:50",\N,\N,"2016-03-31 15:34:58","2","2","2","1","test","3","3","3","0","1","0",\N,"1","0","0",\N,\N,"0","0","0","0","8","0","0","0","0"
"3","0","Test1","2016-03-31 15:34:50",\N,\N,"2016-03-31 15:34:58","2","2","2","1","test","3","3","3","0","1","0",\N,"1","0","0",\N,\N,"0","0","0","0","8","0","0","0","0"
...

我想要显示:

"10","0","Test1","2016-03-31 15:34:50",\N,\N,"2016-03-31 15:34:58","2","2","2","1","test","3","3","3","0","1","0",\N,"1","0","0",\N,\N,"0","0","0","0","8","0","0","0","0"
"20","0","Test1","2016-03-31 15:34:50",\N,\N,"2016-03-31 15:34:58","2","2","2","1","test","3","3","3","0","1","0",\N,"1","0","0",\N,\N,"0","0","0","0","8","0","0","0","0"
"30","0","Test1","2016-03-31 15:34:50",\N,\N,"2016-03-31 15:34:58","2","2","2","1","test","3","3","3","0","1","0",\N,"1","0","0",\N,\N,"0","0","0","0","8","0","0","0","0"
...

我该怎么做? 谢谢

1 个答案:

答案 0 :(得分:0)

如果你不想使用awk或Perl及其Text::CSV,你可以试试一个简单的

sed 's/",/0",/'