It is easy to use Python to remove DOS EOF characters; eg,
def delete_eof(fin, fout): BUFSIZE = 2**15 EOFCHAR = chr(26) data = fin.read(BUFSIZE) while data: fout.write(data.translate(None, EOFCHAR)) data = fin.read(BUFSIZE) import sys ipath = sys.argv[1] opath = ipath + ".new" with open(ipath, "rb") as fin, open(opath, "wb") as fout: delete_eof(fin, fout)
This takes the file path as the first argument and copies the file, but without chr(26) bytes, into the same file path with the addition of .new . Try to taste.
By the way, are you sure that DOS EOF characters are your only problem? It is difficult to imagine a reasonable way in which they can appear in files intended for processing text files.
source share