You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
510 B

#!/usr/bin/env python2
import os
import sys
import re
def main():
re_line = re.compile(r'^(.*?)\s+(.*?)\s+(.*?)$')
with open(sys.argv[1], 'rb') as f:
lines = []
for line in f:
m = re_line.match(line)
assert(m is not None)
t = [ int(m.group(2)), m.group(1), m.group(3) ]
lines.append(t)
lines.sort()
for line in lines:
print('%5d %s %s' % (line[0], line[1], line[2]))
if __name__ == '__main__':
main()