Basically, I want to see how much time every user spent logged in.
(username) pts/0 (IP adress) Tue Dec 12 17:51 - 18:14 (00:22) - this is how one line looks in the last command. The username is between characters 1-9, the time is between 67-71. There are multiple logins from each user, so I want to sum the time based on their username. I already counted how many times one user logged in using
echo `last | sort | cut -c1-9 | uniq -c | sort -n | head -$y`
in a bash script. Is it possible to add up the time of each user using a format similar to this? I was thinking of a for loop, but have no ide how to set it up. Any ideas?