sed command to replace multiple column in one go

Correct, and also process substitution could be used, but just wanted to point out that the stdin placeholder - does not work with BSD sed or other regular sed version. It is also not part of POSIX so it is probably a GNU extension.

Thanks a lot RudiC
It is working in tcsh..

sed -r 's#([^,]*)(,|$)#s/./M/\1\n#g' positions | sed -f- file

---------- Post updated at 04:13 AM ---------- Previous update was at 03:38 AM ----------

Hi RudiC,

If I want to take the output of this command-

sed -r 's#([^,]*)(,|$)#s/./M/\1\n#g' positions | sed -f- file

in one variable instead of one output file.
How to do that?
like- suppose this is the first output

MMMMMMM11111111000000000111111110000000011111111000000001111111100000000111

I want to store this in one variable and use further in some foreach loop.

I don't know if tcsh provides "command substitution" as bash does for variable assignment.