forked from mdscunningham/shell-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-table.sh
executable file
·25 lines (22 loc) · 743 Bytes
/
make-table.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# +----+----+----+----+
# | | | | |
# Author: Mark David Scott Cunningham | M | D | S | C |
# +----+----+----+----+
# Created: 2014-04-28
# Updated: 2014-04-28
#
#
#!/bin/bash
# If you output hits per hour using traffic, and do this for a series of days, you can
# build a table using this loop. You can also then put that table into a spreadsheet
# and you can then get a visual graph per day and compare the traffic during the hours
# of the week, day by day. It really is neato
trafficfile=$1
days=$2
for x in $(seq -w 0 23); do
echo -n "$x:00 ";
for y in $(seq 1 $days); do
printf " $(grep $x: $trafficfile | awk '{print $2}' | head -n$y | tail -1)";
done;
echo;
done | column -t