awk -F'~' -v col="$DATE_COL" -v cutoff="$CUTOFF" '
function month2num(m) {
return (index("JanFebMarAprMayJunJulAugSepOctNovDec", m) + 2)/3
}
{
if (NF < col) { print; next }
d = $col
gsub(/:[0-9]{3}[APMapm]/, substr(d, match(d, /:[0-9]{3}/)+1), d) # drop ms
match(d, /^([A-Za-z]{3})[[:space:]]+([0-9]{1,2})[[:space:]]+([0-9]{4})[[:space:]]+([0-9]{1,2}):([0-9]{2}):([0-9]{2})[[:space:]]+(AM|PM)/, a)
if (!a[0]) next
mon = month2num(toupper(a[1]))
mday = a[2]+0; year = a[3]+0
hour = a[4]+0; min = a[5]+0; sec = a[6]+0
ampm = a[7]
if (ampm == "PM" && hour < 12) hour += 12
if (ampm == "AM" && hour == 12) hour = 0
ts = mktime(year " " mon " " mday " " hour " " min " " sec)
if (ts >= cutoff) print
}'
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)