Skip to content

Instantly share code, notes, and snippets.

View count_group_by_datetime.awk
{
date = $1
hour = substr($2,1,2)
group[date, hour]++
}END{
print "Date" "\t\t" "Hour" "\t" "Total"
print "====" "\t\t" "====" "\t" "======"
for (item in group) print substr(item, 1, 10) "\t" substr(item, 11, 3) "\t", group[item]
}