I want to add these no. these are in the format of
days:hours:minutes:sec
I want result in this format only
0:00:04:59
0:00:00:12
0:00:00:28
0:00:00:03
0:01:29:35
0:00:00:19
0:01:05:21
Is any body ca help me?????
To get This..
Thanks
Nishant
You have to convert the times to integers first, then convert them back to your format.
awk -F: '{
total += $1 * 86400 + $2 * 3600 + $3 * 60 + $4
}
END {
hours = int((total % 86400) /3600)
minutes = int((total % 3600) / 60)
days = int(total / 86400)
secs = total % 60
print days ":" hours ":" minutes ":" secs
} '