def main(argv=None):

    if argv is None:
        argv = sys.argv

    parser.add_option("-t", "--table", dest="tables", type="string",
                      help="tables to merge.",
                      action="append")

    parser.set_defaults(
        tables=[])

    (options, args) = E.Start(parser)

    if len(options.tables) < 1:
        raise "please specify at least one table."

    files = []
    for t in options.tables:
        files.append(open(t, "r"))

    while 1:
        frags = []

        stop = False

        for f in files:
            l = f.readline()
            if not l:
                stop = True
                break
            frags.append(l[:-1])

        if stop:
            break

        print string.join(frags, "\t")

    E.Stop()
script main.
dataset/ETHPy150Open CGATOxford/cgat/scripts/merge_tables.py/main