I meant to add: The reason for doing read rather than readlines or xreadlines is that if it's a binary file, your 'lines' could be very long... Also: you could filter for CR and LF and count those per block as an additional test -- although there may be autowraped text files that are also made of a couple very long 'lines' . -- Steve Majewski