Regex Question: how do I replace a single space with a newline in VI.
:%s/ /^V^M/g
note: hit ctrl-v, ctrl-m.
edit: if you really mean all single spaces, meaning spaces not followed by another space, use this:
:%s/ \{1\}/^V^M/g
and if you really meant just the first single space in the document, use this:
:%s/ /^V^M/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With