Skip to main content
Solved

Remove last CR/LF from a CSV

  • July 8, 2025
  • 3 replies
  • 89 views

redgeographics
Celebrity
Forum|alt.badge.img+61

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.

 

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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+45
  • 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+61

That does look like a good workaround, thanks!


ebygomm
Influencer
Forum|alt.badge.img+45
  • 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 :-)