Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: In the "Text file output" step is there anyway to supress the Line Feed character?

  1. #1
    Join Date
    Mar 2006
    Posts
    170

    Smile In the "Text file output" step is there anyway to supress the Line Feed character?

    In the "Text file output" step is there anyway to supress the Line Feed character being appended to the end of each output row?
    I have tried doing it in both DOS and UNIX formats but they both tack on a LF char.
    I could use a JS step to build one big string by appending each row to it ... and ouptut that one BIG string.
    However that row would also have a LF char added to the end of it.

    Ideas?

    Thanks

    Kent

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    No... essentially you would get 1 big line, which could clash with headers, split over x rows, ...

    Regards,
    Sven

  3. #3
    Join Date
    Mar 2006
    Posts
    170

    Smile That's essentially what I need, 1 big line.

    Hi Sven,

    The flat files we need to make will be 1 big line.
    No headers and can't have any linefeed character after the end of the 1 big line.

    Here is what I have found:

    If you put the last line that needs to be output in the file in the "Text File Output" step on the "content" tab (Think it's called End of File Text ?? last input on that tab) ... for example "This is the End". That line is placed at the end of the file without any linefeed chars behind it.

    This would satisfy our req's except the last line needs to contain the number of records that were placed in the flat file. I thought I could set that number/value in a variable and tack it onto the text that I enter in the "Text File Output" -> Content -> End of Line text input. So it would look like:

    This is the End${No_Records}

    But no luck as that step doesn't allow variables to be evaluated.

    So before I enter a JIRA enhancement for allowing variables within that input field ... what do you think?

    Thanks

    Kent

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    What you want to do is tacky ... I'm not saying is not possible to build in, but I'm not going to do it. The step has been overstretched as it is and implementing something as you want will leave some more gray areas (options which are not working well together in this case, there are already some of those).

    If I were in your shoes I would:
    - Try to convince the other side they don't need 1 big line
    - Alternatively post-process it with a script ... 10 lines of perl should do your case.

    Regards,
    Sven

  5. #5
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    10 lines of perl
    Or one line of sed:

    Code:
    < foo.txt sed 's/\n//g' > bar.txt

  6. #6
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    Quote Originally Posted by MattCasters View Post
    Or one line of sed:
    Or one line of perl:

    Code:
    perl -pi -e  sed 's/\n//g' foo.txt
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  7. #7
    Join Date
    Nov 1999
    Posts
    9,729

    Talking Sorry...

    your line is longer

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.