Remove all white space in a file and replace them with a comma using Vim
Another way to do it :
%s/\s\{1,}/,/gc
First delete the blank lines:
:g/^\s*$/d
Then use a substitution (:s///
) over each line (%
) to replace all (g
) continuous whitespace (\s\+
) with a comma (,
).
:%s/\s\+/,/g