Basically I am trying to convert Line Endings of a large number of files. While I'm doing a lazyread and using regex to replace the line endings
In order to find if the file already exists in desired line ending, I have put an if statement like the one mentioned below:
mreg = b'(?<!\r)\n|\r(?!\n)' if desired_eol == 'CRLF' else b'(?<=\r)\n|\r(?=\n)'
if re.search(mreg, line):
# Change to desired EOL here
else:
# (already in desired line ending)
break
Basically this is working well.
Since I will be reading the file in lazy manner, I would like to know if in a chunk of the whole file the line ending is the desired one, does that mean the entire file is in the desired line ending ?
Kindly please clarify my doubt.