in reply to insert null in missing rows

Another approach could be preallocating hashed of your timedate, then looping over your file, and write the data out. Maybe leave out the seconds, as that might sometimes not be :00 depending on the load of the system

This code might help to loop, and prepend 0 to numbers smaller than 2 digits:

# First, we read the file, put the data into a hash # now, we loop on the day: $day = '2016-02-06'; for $hour (00..23){ for($min=00;$min<60; $min+=10){ $key = sprintf("%s,%02d:%02d", $day,$hour,$min); print "Checking if $key:00 exists\n"; } }

ps: The real world solution is using a RRD (round robin database)