When I’m looking at a server, I often want to see the /etc/my.cnf file nicely formatted, and with comments stripped. This Perl one-liner will pretty-print the file:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
perl -ne 'm/^([^#][^s=]+)s*(=.*|)/ && printf("%-35s%sn", $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 .... |