I want commas in middle spaces not at the end, but here I got commas at the end also...
AFAICT, your problem arises from using \s in the substitution s/\s/,/g, instead of a plain space character, i.e. s/ /,/g.
\s stands for "whitespace", which includes newline (\n), so the newlines are turned into commas, too.
In reply to Re: replace middle spaces with commas
by Anonyrnous Monk
in thread replace middle spaces and write to another file
by sufi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |