如何在不影响其他数字的情况下搜索和替换vi中的日期?

时间:2014-10-08 18:41:46

标签: date search replace wildcard vi

此日期的第4列包含日期。 我想搜索以2014为前缀的每个日期,并将其替换为2013。 我不想改变2014年也可能出现的任何其他专栏中的数字。 我在使用通配符时遇到问题,有人可以告诉我vi命令做这样的事吗? 非常感谢

20140009,20140009,GSM-AHS,20101218132823,46767807490,5302833,IA,d,POST 11 N 20140009,20140009,GSM-AHS,20140119000900,46767807490,5302833,IA,d,POST,N,N- 2014001,2014001,GSM-AHS,20131012212112,46730360076,3922720,HK,我,PRE 11 N 2014001,2014001,GSM-AHS,20140119000900,46730360076,3922720,HK,I,PRE,N,N- 2014001,2014001,GSM-AHS,20140615210515,46730360076,3922720,HK,I,PRE,N,N- 2014001,2014001,GSM-AHS,20140617213108,46730360076,3922720,HK,I,PRE,N,N- 2014001,2014001,GSM-AHS,20140627150239,46730360076,3922720,HK,I,PRE,N,N- 2014001,2014001,GSM-AHS,20140705085247,46730360076,3922720,HK,I,PRE,N,N- 2014001,2014001,GSM-AHS,20140729075246,46730360076,3922720,HK,I,PRE,N,N- 20140012,20140012,GSM-AHS,20101221165213,13,46767674084,1,RO,O,PRE 11 N 20140012,20140012,GSM-AHS,20130113025426,46767674084,1,RO,O,PRE,N,N- 20140016,20140016,GSM-AHS,20130728205747,20145,46767674542,5493416,OU,d,POST 11 N 20140016,20140016,GSM-AHS,20140518005550,46767674542,5493416,OU,d,POST,N,N- 20140017,20140017,GSM-AHS,20131230033641,46767807730,7810638,08,d,POST,N,N- 20140020,20140020,GSM-AHS,20140518005550,46767817323,1090680,OT,d,POST,N,N

1 个答案:

答案 0 :(得分:1)

如果您的所有第3列都包含GSM-AHS,,您可以尝试

:%s/GSM-AHS,2014/GSM-AHS,2013

只会替换第一场比赛,而不会触及剩下的比赛。