Skip to content

Instantly share code, notes, and snippets.

@sh2
Created February 13, 2014 12:05

Revisions

  1. sh2 created this gist Feb 13, 2014.
    15 changes: 15 additions & 0 deletions list.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash

    for BINLOG in $@; do
    echo $BINLOG $(mysqlbinlog $BINLOG 2>/dev/null | awk '/^#[0-9]/ { print $1, $2 }' | head -1)
    done

    ==

    $ ./list.sh mysql/binlog/*
    mysql/binlog/mysql-binlog.000001 #140206 18:14:57
    mysql/binlog/mysql-binlog.000002 #140207 11:13:14
    mysql/binlog/mysql-binlog.000003 #140207 13:04:08
    mysql/binlog/mysql-binlog.000004 #140207 17:20:55
    mysql/binlog/mysql-binlog.000005 #140213 20:19:57
    mysql/binlog/mysql-binlog.index