Skip to content

Instantly share code, notes, and snippets.

@shanemhansen
Last active August 29, 2015 14:06
Show Gist options
  • Save shanemhansen/5e94f395fda57218b080 to your computer and use it in GitHub Desktop.
Save shanemhansen/5e94f395fda57218b080 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from Tkinter import Tk
from tkFileDialog import askopenfilename, asksaveasfilename
Tk().withdraw()
FILE = open(askopenfilename())
OUTPUT = open(asksaveasfilename(), "w")
lines = FILE.readlines()
states = [4,5,6] # 4000, 5000, 6000
print >> OUTPUT, "Im\ta\theader"
for line in lines:
fields = line.split("\t")
if line[0] == '#':
continue
includeline = False
for state in states:
if int(fields[1], 10)/1000 == state:
includeline = True
break
if not includeline:
continue
print >> OUTPUT, "\t".join(fields[0:4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment