May 25, 2012

Post: How to pretty-print my.cnf with a one-liner

… to see the /etc/my.cnf file nicely formatted, and with comments stripped. This Perl one-liner will pretty-print the file: perl -ne ‘m/^([^#][^\s=]+)\s*(=.*|)/ && printf(“%-35s%s\n”, $1, $2)’ /etc/my.cnf [client] port = 3306…