Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Remove/Disable last line from text output

  1. #1

    Question Remove/Disable last line from text output

    I'm doing a simple transformation: Load data from a table and output it to a text file.
    However, by default there is an empty line at the ending of the text file output, caused by the "Add Ending line of file":
    Name:  2016-04-06 10_07_11-Text file output.jpg
Views: 422
Size:  16.3 KB

    I see no way of disabling this, nor have I found a way to work around this.
    Does anyone have suggestions? Any help would be appreciated!

  2. #2
    Join Date
    Oct 2010
    Posts
    369

    Default

    I think idea behind why we have end "Add Ending line to file " is Append feature of "Text File Output" bcoz when we are going to append our records we need to have carraiage return to identify the end of line.
    are you facing any problem with that blank line is in file?

  3. #3

    Default

    Quote Originally Posted by lalgourav View Post
    are you facing any problem with that blank line is in file?
    Yes, we are generating a report for one of our customers which is expecting the report in an exact format.
    Unfortunately we cannot adjust the service which reads this report.

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Quote Originally Posted by Robinnaiitor View Post
    However, by default there is an empty line at the ending of the text file output, caused by the "Add Ending line of file"
    Well, it's definitely not caused by this feature. It's how Kettle composes a text file. While your editor of choice may find the lines in your textfile separated by the specified line ending (\n or \r\n), Kettle writes lines terminated by that character sequence. Thus the perceived empty line at the end of your file. "Add ending line of file" will simply append the given string to the file written so far. No line ending is written this time.

    So, if you must get rid of the final line ending, an easy way would be to use the truncate tool (GNU Core Utils).
    If the first field of your output text file is of type string, and an output header is written, you can avoid postprocessing on the shell level by disabling line endings and prepending the line separator string to the first field.
    Other ways are possible, of course.
    So long, and thanks for all the fish.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.