Math in Vim search and replace
In Vim, you can use function or math in search and replace.
7100,111,222,0
7100,333,444,1
7100,555,666,2
:%s/\(\d*\)$/\=2-submatch(1)/g
7100,111,222,2
7100,333,444,1
7100,555,666,0
7100,111,222,0
7100,333,444,1
7100,555,666,2
:%s/\(\d*\)$/\=2-submatch(1)/g
7100,111,222,2
7100,333,444,1
7100,555,666,0
Comments
Post a Comment