Comment/Uncomment all cron tab entries in one shot

Comment :
sed -i -e ‘/^[ ]*[0-9]/ s/^/#/g’ /var/spool/cron/mysql
Uncomment :
sed -i -e ‘/^#*[ ]*[0-9]/ s/^#*[ ]*//g’ /var/spool/cron/mysql

Commenting and Uncommeting read-only in my.cnf across multiple servers

For commenting the following snippets can be used :
sudo perl -i -p -e ‘ print “#” . ” ” if !/^#/ && /^read-only/; ‘ /etc/my.cnf
sed -i -e ’s/^read-only/#&/g’ cnf
For uncommenting you can use the following snippets :
sudo perl -i -p -e ’s/^#// if /^#/ && /read-only/; ‘ /etc/my.cnf

sed -i -e ’s/^#*read-only/read-only/g’ cnf