Friday 15 July 2011

How do I search and replace date in vi without affecting other numbers? -



How do I search and replace date in vi without affecting other numbers? -

the 4th colum in date contains date. want search every date prefixed 2014 , replace 2013. don't want alter numbers in other column 2014 might appear also. i'm having problem using wildcards, please tell me vi command such thing? much

20140009,20140009,gsm-ahs,20101218132823,,46767807490,5302833,ia,d,post,,n 20140009,20140009,gsm-ahs,20140119000900,,46767807490,5302833,ia,d,post,n,n 2014001,2014001,gsm-ahs,20131012212112,,46730360076,3922720,hk,i,pre,,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,,n 20140012,20140012,gsm-ahs,20130113025426,,46767674084,1,ro,o,pre,n,n 20140016,20140016,gsm-ahs,20130728205747,20145,46767674542,5493416,ou,d,post,,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

if 3rd columns contain gsm-ahs, can try

:%s/gsm-ahs,2014/gsm-ahs,2013

which replace first match only, not touching rest.

date search replace wildcard vi

No comments:

Post a Comment