wytnij.py 648 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def get_lines(word):
    first = True
    cut = False
    maybe_next = False
    lines = []
    for line in sys.stdin:
        if first:
            if line.startswith(word + '\t'):
                cut = True
            elif maybe_next:
                break # już nie ma więcej homonimów
            first = False
        if cut:
            lines.append(line)
        if line == '\n':
            if cut:
                maybe_next = True
            first = True
    return lines


if __name__ == '__main__':
    lines = get_lines(sys.argv[1])
    sys.stdout.write(''.join(lines))