Last active
October 19, 2015 07:38
-
-
Save mjf/df32c94b52e4231bf8f1 to your computer and use it in GitHub Desktop.
mysqlreportfmt - Format MySQL Report Tool's output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Include this function in your ~/.bashrc file | |
# | |
mysqlreport() { | |
$(which mysqlreport) $@ | mysqlreportfmt | less -c -R | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sed -f | |
# mysqlreportfmt - Format MySQL Report Tool's output | |
# Copyright (C) 2015 Matous Jan Fialka, <http://mjf.cz/> | |
# Released under the terms of "The MIT License" | |
/^MySQL / { | |
s/ //5 | |
s/ //5 | |
s/^/\x1b[44;33;1m / | |
s/$/ \x1b[0m/ | |
n | |
} | |
/^__/{ | |
s/^__// | |
s/_/ /g | |
s/$/ / | |
s/^/\x1b[1;7m/ | |
s/$/\x1b[0m\n/ | |
n | |
} | |
/^Data/,$ { | |
/^[ \t]*$/d | |
} | |
/ ON/ { | |
s/ \(ON\)/ \x1b[32;1m\1\x1b[0m/ | |
} | |
/ OFF/ { | |
s/ \(OFF\)/ \x1b[31;1m\1\x1b[0m/ | |
} | |
/\(%[^:]\+\|Log\|Size\):/ { | |
s/\(\(%[^:]\+\|Log\|Size\):\)/\x1b[36;1m\1\x1b[0m/g | |
} | |
/[+-]Unknown/ { | |
s/\([+-]\)\(Unknown\)/\x1b[35;1m\1\x1b[0m\x1b[5m\2\x1b[0m/g | |
} | |
/^[^ ]\+\( [^ ]\+\)*/ { | |
s/^\([^ :]\+\( [^ :]\+\)\{,2\}\)/\x1b[33;1m\1\x1b[0m/ | |
s/:\([^ ]\+\)/:\x1b[36;1m\1\x1b[0m/ | |
} | |
/ of / { | |
s/ of /\x1b[33;1m&\x1b[0m/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On CentOS/RHEL/Fedora: