#!/usr/bin/env python

import glob
import os
import sys


glob_patterns = sys.argv[1:]
if not glob_patterns:
    sys.stderr.write('Usage: %s "<glob-pattern>"\n' % os.path.basename(__file__))
    sys.exit(1)

paths = []
for glob_pattern in glob_patterns:
    for path in glob.iglob(glob_pattern):
        path = os.path.realpath(path)
        if path not in paths:
            paths.append(path)

for path in paths:
    with open(path) as open_file:
        for line in open_file:
            sys.stdout.write(line)
