blob: aeb5eace8fb058d933d81fb27c9acac7c5fc962d (
plain) (
blame)
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
|
#!/usr/bin/env python3
# See LICENSE file for copyright and license details.
import sys
line_count = None
files = []
for path in sys.argv[1:]:
with open(path, 'rb') as file:
data = file.read()
data = data.decode('utf-8', 'strict')
if data[-1] == '\n':
data = data[:-1]
data = data.split('\n')
if line_count is None:
line_count = len(data)
elif len(data) != line_count:
print('%s: line count mismatch' % sys.argv[0], file = sys.stderr)
sys.exit(1)
files.append(data)
for i in range(line_count):
best_sec = None
best_nsec = None
best_line = None
for lines in files:
line = lines[i]
[sec, nsec] = line.split(':')[1].split(' ')[1].split('.')
[sec, nsec] = [int(sec), int(nsec)]
if best_sec is None or sec < best_sec or (sec == best_sec and nsec < best_nsec):
best_sec, best_nsec, best_line = sec, nsec, line
print(best_line)
|