Skip to content

Instantly share code, notes, and snippets.

@nakajijapan
Created April 9, 2012 00:42
Show Gist options
  • Save nakajijapan/2340563 to your computer and use it in GitHub Desktop.
Save nakajijapan/2340563 to your computer and use it in GitHub Desktop.
SQLログをカラー表示
#!/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