Permalink
Browse files

pbio.py: map code over records with -e

  • Loading branch information...
acg committed Feb 9, 2011
1 parent e5706b4 commit a64f2f9eeb497cc83e66f4471ddd7ccdebb05c13
Showing with 7 additions and 1 deletion.
  1. +7 −1 python/pbio.py
View
@@ -26,11 +26,12 @@ def main():
typename = ""
skip = 0
count = -1
mapcode = None
pb2file = None
fin = sys.stdin
fout = sys.stdout
opts, args = getopt.getopt(sys.argv[1:], 'R:W:p:F:d:m:s:c:')
opts, args = getopt.getopt(sys.argv[1:], 'R:W:p:F:d:m:s:c:e:')
for o, a in opts:
if o == '-R':
@@ -47,6 +48,8 @@ def main():
skip = int(a)
elif o == '-c':
count = int(a)
elif o == '-e':
mapcode = compile(a,'<string>','exec')
if len(args): fin = file(shift(args))
if len(args): fout = file(shift(args), 'w')
@@ -81,6 +84,9 @@ def main():
if count >= 0 and written >= count:
break
if mapcode != None:
exec mapcode in record
for k in fields:
if k in record:

0 comments on commit a64f2f9

Please sign in to comment.