Skip to main content
Solved

Remove last CR/LF from a CSV


redgeographics
Celebrity
Forum|alt.badge.img+50

We've set up a process for a client that takes data and writes it to CSV. That CSV is then loaded into a data warehouse.

That CSV conforms to the official CSV standards and thus the last line ends with a CR/LF:

Shown here in Notepad++. This means there's a last, empty, line in the file. The data warehouse system apparently cannot handle this. Is there a way to remove this last CR/LF from the file? (post-processing python, probably).

I must admit I am not convinced this should be fixed on the FME side, but trying to get the data warehouse developers to move on this is not going to happen.

Best answer by ebygomm

The text writer has an option not to write the last terminator.

 

So you could write the csv with the text file writer, or alternatively write the csv, then read it in as a text file and write it out again without the last line terminator.

 

 

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+40
  • Influencer
  • Best Answer
  • July 8, 2025

The text writer has an option not to write the last terminator.

 

So you could write the csv with the text file writer, or alternatively write the csv, then read it in as a text file and write it out again without the last line terminator.

 

 


redgeographics
Celebrity
Forum|alt.badge.img+50

That does look like a good workaround, thanks!


ebygomm
Influencer
Forum|alt.badge.img+40
  • Influencer
  • July 8, 2025

I must admit I am not convinced this should be fixed on the FME side, but trying to get the data warehouse developers to move on this is not going to happen.

Been there got the T-shirt :-)


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings