2011-09-30 | Paul Boddie | raw annotate files changeset graph | Added a wrapper for text files and changed the basic functions to use the API provided by the wrapper. Fixed the copyright information. |
1 #!/usr/bin/env python 2 3 from simplex import * 4 import sys, time 5 6 filename = sys.argv[1] 7 terms = sys.argv[2:] 8 9 f = open(filename) 10 tf = TextFile(f) 11 try: 12 for term in terms: 13 tf.seek(0) 14 15 t = time.time() 16 line = find_in_file(tf, term) 17 if line: 18 print "Found (at %s seconds)...\n%s" % (time.time() - t, line) 19 finally: 20 f.close() 21 22 # vim: tabstop=4 expandtab shiftwidth=4