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
Filed under: mysql | Tagged: commet, inline, my.cnf, perl, sed | Leave a Comment »



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
Filed under: mysql | Tagged: comment, crontab, sed | Leave a Comment »