CS457-w10: Solution to part III.c of Assignment 2


grep [Cc]leaning asp-long | grep delaying >delay
grep [Cc]leaning asp-long | grep enalty >penalty

At this point the files could be cleaned up by hand.
But it's less error-prone to do something like the following.

cat penalty | awk '/Cleaning/{split($2, time, ":")} /Black/{split($2, black, ":")} /White/{split($2, white, ":"); printf("%d:%d:%d \t%d\t%d\n", time[1], time[2], time[3], black[3]-time[3] + 60*(black[2]-time[2]), white[3]-time[3] + 60*(white[2]-time[2]))}' >pres


cat delay | awk '/databases/{split($2, time, ":")} /triplets/{split($2, black, ":")} /tuplets/{split($2, white, ":"); printf("%d:%d:%d \t%d\t%d\n", time[1], time[2], time[3], black[3]-time[3] + 60*(black[2]-time[2]), white[3]-time[3] + 60*(white[2]-time[2]))}'


Results - Penalty

4:17:11         20      429
5:17:11         20      423
6:17:11         20      420
7:17:11         19      425
8:17:12         21      433
9:17:12         23      436
10:17:14        23      452
11:17:13        21      429
12:17:13        21      434
13:17:12        23      435
14:17:17        23      436
15:17:13        22      429
16:17:13        20      421
17:17:12        20      422
18:17:11        19      419
19:17:11        18      417
20:17:10        18      417
21:17:11        17      415
22:17:13        18      415
23:17:13        16      415
0:17:12         17      412
1:17:17         19      462
2:19:24         17      818

Results - Delaying

4:16:38         4       5
5:16:37         5       6
6:16:38         4       6
7:16:38         4       5
8:16:38         5       6
9:16:38         5       7
10:16:39        6       7
11:16:38        6       7
12:16:39        5       6
13:16:38        5       6
14:16:42        5       6
15:16:38        5       7
16:16:38        5       6
17:16:38        4       6
18:16:38        5       6
19:16:38        4       6
20:16:38        4       5
21:16:38        4       6
22:16:40        4       5
23:16:40        4       5
0:16:40         4       5
1:16:42         4       5
2:17:28         5       6