Here’s a simple sed command to replace multiple spaces into a comma delimited file.
sample.txt
<pre lang="bash">
one two
three four
The sed command.
<pre lang="bash">
sed 's/ \+ /,/g' sample.txt > sample2.txt
sample2.txt
<pre lang="bash">
one,two
three,four