-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxyreport.sh
executable file
·62 lines (48 loc) · 1.13 KB
/
proxyreport.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
IFS=$'\n'
num=1
echo "$1 $2 $3"
while [ $num -le $1 ]
do
echo "outputs/csv/$num.html" >>outputs/csv/files
num=$(($num+1))
done
for i in `cat outputs/csv/files`
do
python script $i
done
sed -i 's/html/csv/g' outputs/csv/files
for i in `cat outputs/csv/files`
do
sed -i '19,$ d' $i
done
cat outputs/csv/$1.csv | awk -F ',' '{print $1}' >outputs/csv/names
i=1
while [ $i -le $1 ]
do
echo "$i/$2/$3" >> outputs/csv/monthlyreport
i=$(($i+1))
done
cat outputs/csv/monthlyreport | tr '\n' ',' >>outputs/csv/sortreport
echo "NAME,AVG,"$(cat outputs/csv/sortreport)"" >>outputs/csv/latest.csv
for i in `cat outputs/csv/names`
do
echo $i >>outputs/csv/newvalue
echo "" >>outputs/csv/newvalue
j=1
while [ $j -le $1 ]
do
field=`cat $j.csv | grep -i $i | awk -F ',' '{print $2}' | tr -d '"'`
if [ -z "$field" ]
then
echo "Null" >>outputs/csv/newvalue
else
echo $field >>outputs/csv/newvalue
fi
echo
j=$(($j+1))
done
sed 'H;1h;$!d;x;s/\n/,/g' outputs/csv/newvalue >>outputs/csv/latest.csv
cat /dev/null >outputs/csv/newvalue
done
rm -rf outputs/csv/newvalue outputs/csv/files outputs/csv/names outputs/csv/sortreport outputs/csv/monthlyreport