-
Notifications
You must be signed in to change notification settings - Fork 271
Expand file tree
/
Copy pathlistlogs
More file actions
79 lines (79 loc) · 1.91 KB
/
listlogs
File metadata and controls
79 lines (79 loc) · 1.91 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#must run with bash or <<< redirections won't work
#created by @scry
if [[ $@ == *"-h"* || $@ == *"--help"* ]]; then
echo 'listlogs <wildcard for group of logs>'
echo ' '
echo 'example: listlogs 2021-03-17-*'
echo ' '
echo 'listlogs lists complete chia plot log times and filenames'
echo ' -h --help This screen'
echo ' -d List just filenames'
echo ' -t List just total times'
echo ' -T List just phase 1 times'
echo ' -s Sum of total times'
echo ' -S Sum of phase 1 times'
echo ' -c Return the count of logs with total times'
echo ' -a Return average of total times'
echo ' -A Return average of phase 1 times'
exit
fi
if [[ $@ == *"-A"* ]]; then
opt="-A"
in=${@#"$opt"}
sum=$(grep -iR "Time for phase 1" $in | cut -d' ' -f6 | paste -sd+ - | bc)
len=$(grep -iR "Time for phase 1" $in | wc -l)
bc <<< "scale=2; $sum/$len"
exit
fi
if [[ $@ == *"-a"* ]]; then
opt="-a"
foo=${@#"$opt"}
sum=$(grep -iR "Total time" $foo | cut -d' ' -f4 | paste -sd+ - | bc)
len=$(grep -iR "Total time" $foo | wc -l)
bc <<< "scale=2; $sum/$len"
exit
fi
if [[ $@ == *"-C"* ]]; then
opt="-C"
in=${@#"$opt"}
grep -iR "Time for phase 1" $in | wc -l
exit
fi
if [[ $@ == *"-c"* ]]; then
opt="-c"
in=${@#"$opt"}
grep -iR "Total time" $in | wc -l
exit
fi
if [[ $@ == *"-S"* ]]; then
opt="-S"
in=${@#"$opt"}
grep -iR "Time for phase 1" $in | cut -d' ' -f6 | paste -sd+ - | bc
exit
fi
if [[ $@ == *"-s"* ]]; then
opt="-s"
in=${@#"$opt"}
grep -iR "Total time" $in | cut -d' ' -f4 | paste -sd+ - | bc
exit
fi
if [[ $@ == *"-T"* ]]; then
opt="-T"
in=${@#"$opt"}
grep -iR "Time for phase 1" $in | cut -d' ' -f6
exit
fi
if [[ $@ == *"-t"* ]]; then
opt="-t"
in=${@#"$opt"}
grep -iR "Total time" $in | cut -d' ' -f4
exit
fi
if [[ $@ == *"-d"* ]]; then
opt="-d"
in=${@#"$opt"}
grep -iR "Total time" $in | cut -d: -f1,2,3 | cut -d/ -f3
exit
fi
grep -iR "Total time" $@