Ruby Multi-D arrays Log Files

hi, I’m working on log files as a start to Ruby Learning…

This is the input I have [a cut down version]

a1=[[“10/10/2013”, “user1”, “machine1”, “application1”, “login”,
“8:40:00”],
[“10/10/2013”, “user2”, “machine2”, “application2”, “login”,
“8:42:21”],
[“10/10/2013”, “user1”, “machine1”, “application1”, “logout”,
“8:43:07”],
[“10/10/2013”, “user2”, “machine2”, “application2”, “logout”,
“8:44:13”]]

I would like to calculate the difference between login time and logout
time and store it in a different array …

Desired output

a2= [[“10/10/2013”, “user1”, “machine1”, “application1”, “login”,
“8:40:00”, “logout”,“8:43:07”, “Timeused”, “00:03:00”]]

Please help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs