Reputation: 1480
I have a column of data which looks like this:
0.934
-0.3423
2.346621
0.0032
I would like to have something like this:
0.934
-0.3423
2.346621
0.0032
Is there a regex in VIM to do that or a plugin?
thanks.
Upvotes: 2
Views: 373
Reputation: 161914
In linux
you can do this:
:%!tr . ' ' | xargs printf '\%10s.\%-10s\n'
0.934
-0.3423
2.346621
0.0032
There is a printf()
function in vim
. So you can play this trick in vim:
:%s/\v(.*)\.(.*)/\=printf('%10s.%-10s', submatch(1), submatch(2))
Upvotes: 2