I’m trying to insert a space between letters only, not numbers or other characters.
hello woRLd 12ab34
should become h e l l o w o R L d 12a b34
sed 's/([a-zA-Z])([a-zA-Z])/1 2/g' file.txt
results in h el lo w or LD 12a b34
I can’t insert a space after every letter, as that doesn’t check if the one after that will be a letter also.
I could run the sed
command twice, which solves the problem but is not elegant. I need to solve this problem using sed
, if possible.