Tuesday, 27 August 2013

Cleaning up a text file with a variety of CR and LF line breaks

Cleaning up a text file with a variety of CR and LF line breaks

I'm trying to import into mySQL a text file containing memos. I don't know
how they managed to do this, but while the memo field is consistently
terminated by CR LF, parts of the text itself contains a mixture of CR,
LF, and CR LF line breaks as well.
Naturally this breaks my ability to import it, as there is no clear
indication of what constitutes a line break. Roughly half the data is lost
during import, and 25% of what made the cut ends up truncated.
Is there any feasible way of sorting this mess out? It was originally
exported from Access.
Thanks!

No comments:

Post a Comment