I have two input files. One has namelist, mm:dd form, duration of usage and other host name stuff in each line. The other one is the one that I generated that has a set of namel
I thought this was what you wanted (uses GNU awk 4.* for true multi-dimensional arrays):
$ cat tst.awk
{
n = split($9,t,/[()+:]/)
hours = t[n-3]*24 + t[n-2] + t[n-1]/60
tot[$4][$1] += hours
}
END {
for (month in tot) {
print "["month"]"
for (user in tot[month]) {
print user, tot[month][user] "hours"
}
}
}
$ awk -f tst.awk file
[Dec]
sdou 166.617hours
ermartin 1.31667hours
but the output numbers don't match your expected values:
[Dec]
sdou 94.xxxhours
ermartin 1.19hours
I've spent a lot of time trying to figure out why they're different but I can't. Sorry, hope this helps anyway.