I have a text with a number of coherent strings, e.g.:
ax923fasd asidna1 xxa008
Is there a quick way to convert these so that there be a space between each of them, i.e.:
a x 9 2 3 f a s d a s i d n a 1 x x a 0 0 8
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
There are lots of ways you could do that.
Assuming this is text in a buffer, a simple regexp-based approach is to use M-x
replace-regexp to replace
\& (n.b. that's \&SPC) to replace each non-newline character with itself followed by a space.
As that does match the final character of each non-blank line, that will introduce a space at the end of those lines, which you might wish to clean up with
delete-trailing-whitespace or similar.
A fancier interactive regexp replacement which doesn't append the trailing space would be:
\,(concat \& (if (eolp) "" " "))