Using GNU awk:
awk 'BEGIN { map["Jan"]="01";map["Feb"]="02";map["Mar"]="03";map["Apr"]="04";map["May"]="05";map["Jun"]="06";map["Jul"]="07";map["Aug"]="08";map["Sep"]="09";map["Oct"]="10";map["Nov"]="11";map["Dec"]="12";} { dat=substr($1,9,4)" "map[substr($1,5,3)]" "substr($1,2,2);gsub("]"," ",$2)gsub(":"," ",$2);if ((systime() - mktime(dat" "$2))<=60) { print $0 } }' logfile
Explanation:
awk 'BEGIN { # create an array map with month (short terms) to month numbers
map["Jan"]="01";
map["Feb"]="02";
map["Mar"]="03";
map["Apr"]="04";
map["May"]="05";
map["Jun"]="06";
map["Jul"]="07";
map["Aug"]="08";
map["Sep"]="09";
map["Oct"]="10";
map["Nov"]="11";
map["Dec"]="12";
}
{
dat=substr($1,9,4)" "map[substr($1,5,3)]" "substr($1,2,2); # Create a variable dat with date in a format that can be converted to epoch format
gsub("]"," ",$2); # Convert time to format that can be converted to epoch format with mktime function
gsub(":"," ",$2);
if ((systime() - mktime(dat" "$2))<=600) {
print # If difference between epoch time now (systime) and epoch time of first and second fields is less than or greater than 60, print.
}
}' logfile
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…