Bash script-print a histogram with how many times i logged on

I want to make a shell script which counts for each day how many times i logged on to my computer.Then print a simple histogram with * the number of connections per day. Example:

./script.sh
2021-01-11  
**
2021-11-22  
**************
2021-11-01  
*
2021-10-14  
*

I have write this line

for i in $(last --time-format iso | grep "^$(whoami)" | awk '{print $1 "\t" $4}' | awk -F "T" '{print $1 "\t" $2}' | awk '{print $1 "\t" $2}' | sort -k2)
do

The output:

k   2021-12-19
k   2021-12-19
k   2021-12-18
k   2021-12-17
k   2021-12-17
k   2021-12-17
k   2021-12-16
k   2021-12-15
k   2021-12-14
k   2021-12-13
k   2021-12-12

Now i do not know how to finish this loop.I think i need the uniq command somewhere



from Recent Questions - Stack Overflow https://ift.tt/3sgufHO
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation