原文地址:http://www.mysqlperformanceblog.com/2009/06/15/how-to-pretty-print-mycnf-with-a-one-liner/
当我在一台服务器上转悠时,我会经常想看看/etc/my.cnf文件格式,当然是想看格化美观,没有注释的。这样的一行Perl就能将美化输出文件:
-
perl -ne ‘m/^([^#][^\s=]+)\s*(=.*|)/ && printf(“%-35s%s\n“, $1, $2)’ /etc/my.cnf
-
[client]
-
port = 3306
-
socket = /var/run/mysqld/mysqld.sock
-
[mysqld_safe]
-
socket = /var/run/mysqld/mysqld.sock
-
nice = 0
-
[mysqld]
-
user = mysql
-
pid-file = /var/run/mysqld/mysqld.pid
-
socket = /var/run/mysqld/mysqld.sock
-
port = 3306
-
….
觉得文章有用?立即:
和朋友一起 共学习 共进步!