Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
julien2022
Contributor II
Contributor II

Merge 2 output lines into 1 single line

Hi all

I'm a total newbie into Talend 🙂

I'm using tSSH component in order to execute 2 commands on a Linux server, to get the date + the temperature :

"date +\"%Y-%m-%d %T\"; sensors |grep Package"

0695b00000Rk0JhAAJ.png

This gives me this output :

0695b00000Rk0K6AAJ.png

As you can see, the output gives me 2 lines

  • the first one for the date
  • the second one for the temperature

In order to be able to use this input for powerBI, I would like to get this output into one signle line.

Basically, what I'm willing to get should look like :

2022-06-09 17:29:55 Package id 0: +44.0 .......

Could you please help me to get this reslut? What is the component I need to use?

I've already tried with tNormalise, tDenormalize but did not manage to get what I'm looking for.

Many thanks in advance for your help! 🙂

Kind regards,

Julien

Labels (2)
16 Replies
julien2022
Contributor II
Contributor II
Author

I've tried with a simple file :

 

0695b00000Rk5Y3AAJ.pngAnd the Denormalization is working fine :

 

0695b00000Rk5XyAAJ.png 

 

So I think my issue is focused on the output from the 3 commands

 

=> maybe the result of these 3 commands are NOT seen as 3 "real" lines ??? 😕

But why??

 

Here is the tlogrow result of these 3 commands :

 

0695b00000Rk5ZQAAZ.png 

 

 

 

InfoCraft
Creator
Creator

I see a single row at the output of the tDenormalize_1 component.

which would mean that the response contains carriage returns ===> Put a tJavaRow to replace the carriage return with ; ===> "\n"-->";"

julien2022
Contributor II
Contributor II
Author

Sorry, I'm discovering the tJavaRow component, and am not familiar at all with it....

 

But for sure, there is something around the carriage returns (see my other post : the output of the 3 shell commands seem not seen as 3 real lines).

 

 

I've tried something, but doesn't work (there was 0,1% chance it worked.... 😂

 

0695b00000Rk5cPAAR.png 

Could you please precise how I should use this tJavaRow?

InfoCraft
Creator
Creator

0695b00000Rk5d3AAB.png0695b00000Rk5d8AAB.pngContact me in private if you still can't find the solution, so as not to pollute the discussion

julien2022
Contributor II
Contributor II
Author

Many many thanks to you, dear @not specified not specified​  !!! 😊

 

Thanks to your help, I've managed to get what I expected, by using this tJavaRow component :

 

0695b00000Rk6BtAAJ.pngThe results of the command are now displayed on a single row, which is what I was looking for.👍

 

 

Just on last point (which is not blocking, but would be nice if you had an idea) :

in order to write the result to a file, I'm using tFileOutputDelimited.

 

But the (little) issue I have is that it gives a blank line between each result :

 

0695b00000Rk6EdAAJ.png 

 

Do you have any idea how I can delete these empty lines?

 

InfoCraft
Creator
Creator

Bravoo👏

  1. try replacing "\n" with "\r\n" if that doesn't work 2️⃣
  2. to avoid complicating your task, put a tFilterRow between tJava and tFileOutputDelimited0695b00000Rk77JAAR.png

 

NB. Next time, to avoid this kind of problem copy the result of your commands and paste in NotePad++ then activate the "show all characters" button to get an idea before developing.

0695b00000Rk7NHAAZ.png

julien2022
Contributor II
Contributor II
Author

You're a real beast!! 😊

 

Many thanks again, that worked perfectly with tFilterRow :

 

0695b00000Rk7u6AAB.png 

I'm now getting the exact result I was looking for, that means :

  • the result of the 3 commands into 1 single line
  • no empty line btw each execution of the job

 

0695b00000Rk7vOAAR.png 

Perfect!!

Thank you very much again and enjoy your weekend! 😎

 

Julien