美化/etc/my.cnf文件
http://www.itjxue.com 2015-07-17 08:18 来源:未知 点击次数:
当我在一台服务器上转悠时,我会经常想看看/etc/my.cnf文件格式,当然是想看格化美观,没有注释的。这样的一行Perl就能将美化输出文件:
1.perl -ne ‘m/^([^#][^\s=]+)\s*(=.*|)/ && printf(”%-35s%s\n”, $1, $2)’ /etc/my.cnf
2.[client]
3.port = 3306
4.socket = /var/run/mysqld/mysqld.sock
5.[ mysqld_safe ]
6.socket = /var/run/mysqld/mysqld.sock
7.nice = 0
8.[ mysqld ]
9.user = mysql
10.pid-file = /var/run/mysqld/mysqld.pid
11.socket = /var/run/mysqld/mysqld.sock
12.port = 3306
13…..