Search code examples
pentahopentaho-spoon

Pentaho : Text file output : Remove CR&LF from last line of the file generated


Pentaho - 
Design  : Text file output
Requirement :

- Read values from DB and create a csv file.
- I want to remove the CR & LF from the last line in the generated file.

This empty last line is causing problem while file parsing so I want to get rid of it.

Sample example here :

enter image description here

Test.ktr : https://ufile.io/ug06w This produces output.csv in which last line contains CRLF (contains 3 lines - blank line at the end of file)

input.csv https://ufile.io/lj0tj (To simulate values coming from database, contains 2 lines)


Solution

  • I could solve this using Shell Script component. After generating file I added a post process step to remove the empty line at the end of the file.

    There could be other solutions but this fulfilled my requirement.

    Thank you.