A colleague is trying to read a CSV file in FME 2024.2, but the file appears to be generated by Linux-based software. As a result, FME interprets the entire file as a single block of text instead of recognizing each line as a new row. Does anyone know how to ensure FME correctly identifies each line break in this file?
Page 1 / 1
Single carriage return is normally Macintosh and FME would normally handle this correctly, but I think it’s the linefeed at the end of the file that’s causing the issue (I can recreate).
To check that’s the issue you could remove it in Notepad++ and see if that solves it and allows FME to read it.
You can use AttributeSplitter in FME to split the text on Carriage return (\r).
This gives a list, that you can turn into features using ListExploder.
Next split those features on Horizontal tab (\t), and turn this list into attributes.
@ebygomm This works,thanks for the suggestion. However my colleague would like to automate the script without needing to do manual work.
You could effectively do the same thing in FME.
Read the csv as text with the settings whole file at once, replace the line feed with the string replacer , and write it back out, before reading it in again as a csv.
You will need to check what setting to use for Character Encoding in the File Contents, otherwise you might lose the tabs (this is also the case for @geomancer ‘s answer above)
I’d be concerned that if you don’t know how these csv’s are generated, there may be other issues you aren’t aware of, or they may be produced inconsistently.