Ron McLeod wrote:This may not be the best solution, but maybe use it a starting point for something better:
last | awk '/^wtmp/ || /^$/ {next;} !seen[$1]++ {print $1}'
It will return a list of unique usernames (field 1) while maintaining order. It also removes the blank line and the line beginning with wtmp which is included in the command output. Remove {print $1} if you want to see the whole line.
awk isn't the only way of doing this ?
I know that awk is one way but somehow this will go out of bound or may miss some date using the shell scripts or any programming languages.