Browse Source

formatting changes. updated to use recent++

master
Sam Hunter 3 months ago
parent
commit
082b904517
  1. 42
      ahist
  2. 29
      ahist.totals
  3. 39
      dhist
  4. 41
      uhist

42
ahist

@ -1,20 +1,24 @@
#! /bin/sh
recent |\
awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
BEGIN{
#printf("%-10s %-20s\n","Date","Activity")
}
{
a[$3]++
max=a[$3]>max?a[$3]:max
}
END{
for (d in a) {
printf("%3d %15.15s %-20.20s\n",a[d], d,hist(a[d],max))
}
}'|\
sort -k1r,2n
#! /bin/bash
# App/Services usage histogram
# Author: samhunter@rawtext.club
# https://git.rawtext.club/samhunter/rtc-shell-scripts
#
PROGNAME="${0##*/}"
VERSION="1.0"
recent++ \
| awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
{ a[$3]++
max=a[$3]>max?a[$3]:max
}
END{
for (d in a) {
printf("%3d %15.15s %-20.20s\n",a[d], d,hist(a[d],max))
}
}' \
| sort -k1r,2n
# vim: ts=4 sw=4 expandtab :

29
ahist.totals

@ -0,0 +1,29 @@
#! /bin/bash
# App/Services usage histogram (gab totals)
# Author: samhunter@rawtext.club
# https://git.rawtext.club/samhunter/rtc-shell-scripts
#
PROGNAME="${0##*/}"
VERSION="1.0"
if (( $# > 0 )); then
recent++ --since "$@"
else
recent++
fi \
| awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
{ gsub(/-.*/,"",$3);
a[$3]++
max=a[$3]>max?a[$3]:max
}
END{
for (d in a) {
printf("%3d %15.15s %-20.20s\n",a[d], d,hist(a[d],max))
}
}' \
| sort -k1r,2n
# vim: ts=4 sw=4 expandtab :

39
dhist

@ -1,17 +1,24 @@
#! /bin/sh
recent |\
awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
{
a[$1]++
max=a[$1]>max?a[$1]:max
}
END{
for (d in a) {
printf("%10s %8i %-20.20s\n",d, a[d],hist(a[d],max))
}
}'|\
sort -r
#! /bin/bash
# Services usage by date histogram
# Author: samhunter@rawtext.club
# https://git.rawtext.club/samhunter/rtc-shell-scripts
#
PROGNAME="${0##*/}"
VERSION="1.0"
recent++ \
| awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
{ a[$1]++
max=a[$1]>max?a[$1]:max
}
END{
for (d in a) {
printf("%10s %8i %-20.20s\n",d, a[d],hist(a[d],max))
}
}' \
| sort -r
# vim: ts=4 sw=4 expandtab :

41
uhist

@ -1,20 +1,23 @@
#! /bin/sh
recent |\
awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
BEGIN{
#printf("%-10s %-20s\n","Date","Activity")
}
{
a[$4]++
max=a[$4]>max?a[$4]:max
}
END{
for (d in a) {
printf("%3d %15.15s %-20.20s\n",a[d], d,hist(a[d],max))
}
}'|\
sort -k1r,2n
#! /bin/bash
# Services usage by user histogram
# Author: samhunter@rawtext.club
# https://git.rawtext.club/samhunter/rtc-shell-scripts
#
PROGNAME="${0##*/}"
VERSION="1.0"
recent++ \
| awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
{ a[$4]++
max=a[$4]>max?a[$4]:max
}
END{
for (d in a) {
printf("%3d %15.15s %-20.20s\n",a[d], d,hist(a[d],max))
}
}' \
| sort -k1r,2n
# vim: ts=4 sw=4 expandtab :

Loading…
Cancel
Save