My guess is that your file is small enough that Danny's two-pass approach will work. You might even
be able to do it in one pass.
If you have enough RAM, here is a sketch of a one-pass solution:
# This will map each result to a list of queries that contain that result
results= {}
# Iterate the fi
Thanks for the thoughts so far. After posting I have been thinking
about how to pare down the file (much of the info in the big file was
not relevant to this question at hand).
After the first couple of responses I was even more motivated to
shrink the file so not have to set up a db. This test w