Strip lines from files

Francesco Pietra chiendarret at
Mon Jan 7 16:45:39 CET 2008

I am posting again as previous identical message had alleged suspicious header.

I used successfully script

f=open("prod1-3_no_wat_pop.pdb", "r")
for line in f:
	if "WAT" not in line:
		print line

to strip lines containing the word WAT from a very long file.

A variant need has now emerged, to perform the same task from a very long
series of shorter files trp.pdb.1, trp.pdb.2 ,.....  Could you see how to adapt
the above script to the new need?

Or adapt

grep -v WAT trp.pdb.1

grep -v WAT trp.pdb.2


grep -v WAT trp.pdb.n

Unless you can think better to remove that pervasive molecule of water, to
avoid performing the calculation ex novo.


francesco pietra

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

More information about the Python-list mailing list