使用 vi 编辑器用 csv 文件中的双引号替换数字
Replace number with double quotes from csv file using vi editor
我有一个包含如下数据的 CSV 文件 -
"Rank","Domain","Open Page Rank"
"1","fonts.googleapis.com","10.00"
"2","facebook.com","10.00"
"3","twitter.com","10.00"
"4","google.com","10.00"
"5","youtube.com","10.00"
"6","instagram.com","10.00"
"7","s.w.org","10.00"
"8","ajax.googleapis.com","10.00"
"9","linkedin.com","10.00"
如何使用 vi 编辑器或类似效果从此处的所有数字中删除双引号?
谢谢
您可以使用正则表达式搜索并替换:
%s/"\(\d\+\(\.\d\+\)\?\)"//g
"在文件的每一行,找到...
所有以双引号开头的字符串...
后跟一位或多位数字...
可选地,后跟一个句点,然后是一个或多个数字...
后跟双引号...
用外部捕获组替换字符串...
并在它出现在线路上的任何地方进行。
“
我有一个包含如下数据的 CSV 文件 -
"Rank","Domain","Open Page Rank"
"1","fonts.googleapis.com","10.00"
"2","facebook.com","10.00"
"3","twitter.com","10.00"
"4","google.com","10.00"
"5","youtube.com","10.00"
"6","instagram.com","10.00"
"7","s.w.org","10.00"
"8","ajax.googleapis.com","10.00"
"9","linkedin.com","10.00"
如何使用 vi 编辑器或类似效果从此处的所有数字中删除双引号?
谢谢
您可以使用正则表达式搜索并替换:
%s/"\(\d\+\(\.\d\+\)\?\)"//g
"在文件的每一行,找到...
所有以双引号开头的字符串...
后跟一位或多位数字...
可选地,后跟一个句点,然后是一个或多个数字...
后跟双引号...
用外部捕获组替换字符串...
并在它出现在线路上的任何地方进行。
“