update gemstats.fish

This commit is contained in:
exquisitecorp 2021-07-17 03:36:54 -05:00
parent 87646dfc51
commit ada18a8128
1 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,15 @@
#!/usr/bin/env fish
###########################################
# #
# gemstats by #
# exquisitecorp #
# #
# public domain #
# 2021 #
# #
###########################################
set access_log ~/code/gemstats/temp.log
cat "/home/gemini/access.log" > $access_log
@ -16,10 +26,11 @@ else
set pyear $year
end
# missing cal command so next line won't run
# set total_days_prev_month (cal $pmonth $pyear |egrep -v [a-z] |wc -w)
#
# we don't have cal installed
# so here is my workaround
# fish is 1-indexed
#
# J F M A M J J A S O N D
set month_days 31 28 31 30 31 30 31 31 30 31 30 31
@ -37,6 +48,8 @@ set subtotal2 (grep $USER $access_log | grep (date +"%m") | wc -l)
echo "Gemlog stats for ~$USER"
echo "Views today: " (grep $USER $access_log | grep (date +"%Y-%m-%d") | wc -l)
echo "Views past month: " (math $subtotal + $subtotal2)
# removing my own IP address
echo "Views for all time: " (grep $USER $access_log | grep -v "69.120.239.191" | wc -l)
rm $access_log