更改键的值,然后使用正则表达式以逗号分隔的CSV格式删除键 [英] Change the value of the key, then delete the key on comma delimited CSV using regex

查看:210
本文介绍了更改键的值,然后使用正则表达式以逗号分隔的CSV格式删除键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种模式:

...,432,3333333,607,5500,617,5000,...
...,66,88,432,22625,607,45330,617,5000,...
...,432,3600,000,607,87,617,5000,...

从逗号分隔的多列csv文件中,
数据应该是,第一列应该是键,第二列应该是值,所以我要求做的是将所有特定的键设置为零,并删除键

From a multi columned csv file delimited by comma, The data should be, the first column should be the key, the second column should be the value, so what I was asked to do is to set all specific keys to zero, and delete the key

我需要将所有607键删除到csv,以上结果应该是:

I need to delete all "607" keys to the csv hence, the above should result to:

...,432,3333333,0,0,617,5000,...
.. 。,66,88,432,22625,0,0,617,5000,...
...,432,3600000,0,0,617,5000,...

希望这可以在正则表达式中完成,因为在excel中这不能再做了。

Hope this can be done in regex, because this can't be done anymore in excel.

谢谢!

推荐答案

正则表达式:

,607,[^,]*

替换字符串:

,0,0

演示

这篇关于更改键的值,然后使用正则表达式以逗号分隔的CSV格式删除键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆