Hi,
I have 50 shells in a particular directory. In each shell, we have a variable
MAIL_SUCCESS=abc@xyz.com,def@xyz.com,emi@xyz.com
The variable could be different. Now my requirement is I've to replace abc with def in all the shells present. I have been able to get the command for that:
find . -name "*.sh"|xargs perl -pi -e 's/abc\@xyz.com/def@xyz.com/g'
But, the problem is, if the variable already contains def@xyz.com, then i just need to remove abc@xyz.com. In such case, I've to give the command:
find . -name "*.sh"|xargs perl -pi -e 's/abc\@xyz.com,?//g'
How do I join both commands such that, if abc@xyz.com and def@xyz.com appear in the same line, then remove abc@xyz.com , else replace abc@xyz.com with def@xyz.com