I have this pattern
a,abc_def_eghi
1,234_556
5,567_987_ghi
I want to replace the first _ with a ",". I know %s/old/new/g to replace contents in vim.
Result
a,abc,def_eghi
1,234,556
5,567,987_ghi
Could you suggest some alternatives to go about it
From stackoverflow
-
The "g" is for "global". If you leave it off, the substitution will apply only once on each line.
%s/old/new/
-
If you only want to replace the first occurrence of a match, do not use the
g
modifier. That is, uses/old/new/
instead ofs/old/new/g
. More vim search/replace tips and tricks can be found over at Wikia.
0 comments:
Post a Comment