[mysqld] log-update log-long-format #### # Time: 011206 9:47:01 # User@Host: john[john] @ [10.10.10.112] INSERT INTO official_holidays (OHDate,OHName) VALUES ( "2000/01/01" , "New Years Day"); #### #!/usr/bin/perl -w use strict; my $start_copy = 0; while (<>) { next if /^\s+$/; if ((!$start_copy) and (/^# Time: (\d+)\s+(\d+):(\d\d):(\d\d)/)) { my $date = $1; my $hour = $2; # check if date and time are what you need if ((substr($1,4,2) eq "06") and ($hour gt "09")) { $start_copy = 1; } } print if $start_copy; }