"sf" <[EMAIL PROTECTED]> wrote: > I have files A, and B each containing say 100,000 lines (each line=one > string without any space) > > I want to do > > " A - (A intersection B) " > > Essentially, want to do efficient grep, i..e from A remove those lines which > are also present in file B.
that's an unusual definition of "grep", but the following seems to do what you want: afile = "a.txt" bfile = "b.txt" bdict = dict.fromkeys(open(bfile).readlines()) for line in open(afile): if line not in bdict: print line, </F> -- http://mail.python.org/mailman/listinfo/python-list