Lock_time: 0
にマッチした行と、その次の 3 行を除外する- OSX では ggrep を使う
- 参考: http://unix.stackexchange.com/questions/226348/how-to-grep-v-and-also-exclude-the-next-line-after-the-match
$ grep -P -A 3 'Lock_time: (?!0)' slowquery.log
# Query_time: 0.017416 Lock_time: 1.000000 Rows_sent: 0 Rows_examined: 0
use test;
SET timestamp=1452839731;
commit;
--
# Query_time: 0.017416 Lock_time: 2.000000 Rows_sent: 0 Rows_examined: 0
use test;
SET timestamp=1452839734;
commit;