I have a file which is, sometimes, not properly formatted because of CR/LF.
A good file looks like this:
R00023j Field1 Field2 .... CR/LF R00024n Field1 Field2 .... CR/LF R00025k Field1 Field2 .... CR/LF
But sometime I have a CR/LF inserted in one the fields and It produce a file like this:
R00023j Fiel CR/LF d1 Field2 .... CR/LF R00024n Field1 Field2 .... CR/LF R00025k Field1 Field2 .... CR/LF
We can consider that we have "goods" CR/LF (at the end of the line) and "bad" CR/LF (into a field).
We can consider that a good CR/LF is the one with RxxxxxY
immediatly after it, on the next line.
All other CR/LF are bads and have to be replace by a .
(dot).
x
: digit
Y
: letter
How is is possible to achieve a file data cleansing with a Windows batch file and RegEx?