Inserting/Deleting newline(s) in very large text files

Dlanor Slegov dlanorslegov at rocketmail.com
Thu Aug 12 11:12:33 EDT 2010


Hi,

I am dealing with very large text files (a few million lines) and would like to 
check and modify them according to a well defined format. The format 
requires ONLY ONE NEWLINE (followed by some sort of text) on top of the file and 
NO NEWLINE in the very end. The input files can be very diverse, such as one 
file may have 2 newlines on top and none in the end or other may not have a 
newline on top and 5 in the end. 


The aim is to check these files & introduce JUST ONE NEWLINE in the TOP and NO 
NEWLINE in the BOTTOM.

Any pointers will be appreciated.

Thanks,
DS.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100812/d2d0092b/attachment.html>


More information about the Python-list mailing list