multipe pattern

Extract of configuration file.

members         server1.domain1.com,server2.domain2.com,server3.domain3.com

I am writing a script to remove the server members from a conf file. When I run the script the corresponding server should be removed from the file.

/root/server-remove.sh server1.domain1.com
or
/root/server-remove.sh server3.domain3.com

Both of the above commands should remove the corresponding server from file. As the server name can end in comma or without comma, I am not able to use pattern replacement using sed. Please help me.

See if this "sed" works for you:

sed 's/server1.domain1.com[,]\{0,1\}//' Inp_File

Might I suggest a minor improvement:

sed 's/server1\.domain1\.com[,]\{0,1\}//' Inp_File

so it doesn't match things like server1_domain.com by accident