filter5

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-…


This content originally appeared on DEV Community and was authored by Query Filter

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
}'


This content originally appeared on DEV Community and was authored by Query Filter


Print Share Comment Cite Upload Translate Updates
APA

Query Filter | Sciencx (2025-11-28T20:37:50+00:00) filter5. Retrieved from https://www.scien.cx/2025/11/28/filter5/

MLA
" » filter5." Query Filter | Sciencx - Friday November 28, 2025, https://www.scien.cx/2025/11/28/filter5/
HARVARD
Query Filter | Sciencx Friday November 28, 2025 » filter5., viewed ,<https://www.scien.cx/2025/11/28/filter5/>
VANCOUVER
Query Filter | Sciencx - » filter5. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/11/28/filter5/
CHICAGO
" » filter5." Query Filter | Sciencx - Accessed . https://www.scien.cx/2025/11/28/filter5/
IEEE
" » filter5." Query Filter | Sciencx [Online]. Available: https://www.scien.cx/2025/11/28/filter5/. [Accessed: ]
rf:citation
» filter5 | Query Filter | Sciencx | https://www.scien.cx/2025/11/28/filter5/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.