Created
April 9, 2012 00:42
-
-
Save nakajijapan/2340563 to your computer and use it in GitHub Desktop.
SQLログをカラー表示
This file contains 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/perl | |
#$str = $_; | |
#$str =~ s/\[SQL\]/\033\[1;36m$&\033\[0m/g; | |
#$str =~ s/INSERT.+\n/\033\[1;32m$&\033\[0m/g; | |
#$str =~ s/SELECT.+\n/\033\[1;33m$&\033\[0m/g; | |
#print $str; | |
use strict; | |
use warnings; | |
while(<>) { | |
s/\[SQL\]/\033\[1;36m$&\033\[0m/g; | |
s/INSERT.+\n/\033\[1;32m$&\033\[0m/g; | |
s/UPDATE.+\n/\033\[1;34m$&\033\[0m/g; | |
s/SELECT.+\n/\033\[1;33m$&\033\[0m/g; | |
s/DELETE.+\n/\033\[1;33m$&\033\[0m/g; | |
print; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment