index.sort()
return index

def print_sorted(filename, col_sort):
    index = build_index(filename, col_sort)
f = open(filename)
for col, offset, length in index:
    f.seek(offset)
print(f.read(length).rstrip('\n'))
if __name__ == '__main__':
    filename = 'somefile.txt'
sort_col = 2
print_sorted(filename, sort_col)
sorting large text data