Hello ! I have the following bash script:
Code:
#!/bin/bash
echo "The script starts now."
echo "Hi, $USER!"
echo "Count of logins for each user:"
#!/bin/sh
last > logs.txt
awk '{count[$1]++}END{for(j in count) print j, "("count[j]"logins)"}' logs.txt
What it does is count logins to my network and print on screen the total
of logins each user has.
How can I have my results in descending order according to the loggins of each user?
For example the result should be like:
ampaltas (80logins)
amaxilat (61logins)
altanis (70logins)
alkalai (70logins)
alexopo (20logins)
alexiou (18logins)
alexandz (17logins)
alavernt (11logins)
akribopo (11logins)
akretsis (10logins)
akis (2logins)
akatis (1logins)