Page 1 of 1

How To Avoid LF in source file

Posted: Wed Jan 03, 2018 3:42 pm
by mce
Hi,

I am trying to load data from a text file, but text file has LF characters randomly in many places within the text.
TI is treating those LF characters as line breaks, although there should not be line breaks in those places.
I need TI avoid those LF characters. How can achive this? Any ideas?

Thanks in advance for all replies...
LF_issue.JPG
LF_issue.JPG (60.01 KiB) Viewed 2880 times

Re: How To Avoid LF in source file

Posted: Wed Jan 03, 2018 4:43 pm
by qml
I think you'll have to do some sort of pre-processing of the file to remove the unwanted LF characters. You can do it directly in TI (if you have a way of recognising where the genuine new lines should be - e.g. any LF within a string enclosed in double quotes would be a candidate for removal), but it is way simpler and more elegant to write an external script (e.g. Perl or Python) to deal with the problem before you feed fixed files to TI.

As far as I know there is no way to tell TI which character is used as record separator - most typical newline characters (\r, \f, \n and some combinations thereof) will be recognised as the end of a data record.

Re: How To Avoid LF in source file

Posted: Thu Jan 04, 2018 7:42 am
by macsir
Yes, Perl can deal with these characters pretty easy.