Using awk to Summarize Log File in 5min Intervals

I have huge log file that taken every minute
and I need the total at 5min intervals.

Sample log:

#timestamp(yyyymmddhhmm);result;transaction
201703280000;120;6
201703280001;120;3
201703280002;105;3
201703280003;105;5
201703280004;105;5
201703280005;105;4
201703280006;120;2
201703280007;120;2
201703280008;105;5
201703280009;105;8

Then roughly be like this

201703280000;120;9
201703280000;105;13
201703280005;105;17
201703280005;120;4

That is sparse a specification! Try

awk -F";" 'NR > 1 {T[int($1/5)*5 FS $2]+=$3} END {for (t in T) print t FS T[t]}' CONVFMT="%.f" file
201703280000;120;9
201703280005;105;17
201703280005;120;4
201703280000;105;13
2 Likes

Hi RudiC
Awesome dude, Thanks for the answer!