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 |
<br>perl -ne 'm/^([^#][^s=]+)s*(=.*|)/ && printf("%-35s%sn", $1, $2)' /etc/my.cnf<br>[client] <br>port = 3306<br>socket = /var/run/mysqld/mysqld.sock<br>[mysqld_safe] <br>socket = /var/run/mysqld/mysqld.sock<br>nice = 0<br>[mysqld] <br>user = mysql<br>pid-file = /var/run/mysqld/mysqld.pid<br>socket = /var/run/mysqld/mysqld.sock<br>port = 3306<br>....<br> |