Skip to content

Instantly share code, notes, and snippets.

@terrycojones
Created January 9, 2015 00:49
Show Gist options
  • Save terrycojones/ea104b0be50f25e6fa62 to your computer and use it in GitHub Desktop.
Save terrycojones/ea104b0be50f25e6fa62 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
from collections import defaultdict
seen = defaultdict(list)
for lineNumber, line in enumerate(sys.stdin):
if lineNumber:
fields = line.split('|')
key = '|'.join(fields[:2] + fields[3:])
seen[key].append(line)
for lines in seen.itervalues():
if len(lines) > 1:
for line in lines:
print line,
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment