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)
1 Solution

Accepted Solutions
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

 

View solution in original post

16 Replies
Anonymous
Not applicable

I presume that you are sending the output to the globalMap using the functionality of the component? If so, you can achieve this with some Java String manipulation. The process for doing this will be to let this tSSH component run and connect it to a tJavaFlex using an OnComponentOK link. The tJavaFlex will need the String manipulation code in the Main section.

 

I am not sure of the exact text that the tSSH is returning as it is in a screenshot. But if you are not familiar with Java String manipulation, get the output sent to the globalMap, print it the screen from the tJavaFlex and then send us the returned text EXACTLY in text format. I will take a look and see what is best.

julien2022
Contributor II
Contributor II
Author

Thanks for your feedback

 

This is the exact output that I get on the console :

 

Démarrage du Job nuc à 19:18 09/06/2022.

[statistics] connecting to socket on port 3939

[statistics] connected

[WARN ] 19:19:00 org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier- Server at /192.168.1.80:22 presented unverified EC key: SHA256:8+S46OmYvVoC26F0T6tOMlOVGbjIBI6jjTq8bXze1Hs

[WARN ] 19:19:01 org.apache.sshd.client.session.ClientConnectionService- globalRequest(ClientConnectionService[ClientSessionImpl[root@/192.168.1.80:22]])[hostkeys-00@openssh.com, want-reply=false] failed (SshException) to process: EdDSA provider not supported

2022-06-09 19:19:01

Package id 0: +45.0�C (high = +100.0�C, crit = +100.0�C)

[statistics] disconnected

 

Job nuc terminé à 19:19 09/06/2022. [Code de sortie = 0]

 

 

****

In fact, what I would like to achieve is :

 

Insead of :

2022-06-09 19:19:01

Package id 0: +45.0�C (high = +100.0�C, crit = +100.0�C)

 

I need :

2022-06-09 19:19:01 Package id 0: +45.0�C (high = +100.0�C, crit = +100.0�C)

 

 

Or, more generaly, if I use these commands, for an other exemple :

 

date +\"%Y-%m-%d %T\"; pwd

 

 

 

0695b00000Rk1VUAAZ.png 

 

Instead of getting this (each command on a seperate line) :

 

2022-06-09 19:21:24

/root

 

 

I need the result of the 2 commands on the same line :

2022-06-09 19:21:24 /root

 

 

What is the component I need to use to reach that?

 

Many thanks in advance.

Julien

InfoCraft
Creator
Creator

Hello, qu'est ce que ça donne quand tu mets la sortie en normal ?

0695b00000Rk1hQAAR.png0695b00000Rk1gwAAB.png

julien2022
Contributor II
Contributor II
Author

Hello

Merci pour la réponse en français 🙂

 

En fait, ca donne toujours 2 lignes :

 

0695b00000Rk2TAAAZ.png 

 

 

Mais cela provient, basiquement, du fait que j'exécute 2 commandes via le tShell

 

0695b00000Rk2PNAAZ.png 

 

Si j'en exécutais 3 :

0695b00000Rk2S2AAJ.png

J'aurais 3 lignes :

0695b00000Rk2SMAAZ.png 

 

Ce que je voudrais, c'est afficher le résultat de mes N commandes sur 1 seule ligne.

 

julien2022
Contributor II
Contributor II
Author

J'ai aussi essayé ça :

 

0695b00000Rk2XqAAJ.png 

Mais le résultat est toujours sur 3 lignes distinctes :

 

0695b00000Rk2Y5AAJ.png

InfoCraft
Creator
Creator

Bonsoir,

Dans ce cas là, essai ainsi

0695b00000Rk3FxAAJ.png0695b00000Rk3GgAAJ.png

*** Petit test

0695b00000Rk3IwAAJ.png0695b00000Rk3JVAAZ.pngNB. tu peux personnaliser le séparateur en mettant espace" " à la place de ";" ou autres...

Anonymous
Not applicable

Interesting nickname @not specified not specified​ 😷

It seems I misinterpreted the requirement here and started a path that wasn't required. Thanks for picking this up and creating the right solution 👍

julien2022
Contributor II
Contributor II
Author

I'll go ahead in english, to get more poeple able to help, hopefully 😉

 

Many thanks for help.

The feedback you gave seems to be the right direction.

 

But for a reason I don't understand, it still doesn't work for me 😔

 

The result I get is still on multiple lines, instead of being into 1 single line.

 

0695b00000Rk5VJAAZ.png 

 

 

Here are some details, if that can help understanding what is not fine :

 

 

0695b00000Rk5WgAAJ.png 

3 commands executed to Linux host, with tShell, with "normal" output

 

0695b00000Rk5ViAAJ.png 

outputline :

0695b00000Rk5VnAAJ.pngtlogRow_1 :

 

0695b00000Rk5VxAAJ.png 

 

tDenormalize :

 

0695b00000Rk5W7AAJ.png 

tlogRow_2 :

0695b00000Rk5WMAAZ.png 

 

My aim is to get :

/home/julien; debian11; 9

 

 

Insead of getting this (bad) result :

/home/julien

debian11

9

 

 

 

There might be something set incorrectly, but I don't know what....

 

If you could help me clarifying that, it would be really great!! 😀

 

Many thanks in advance!

 

Regards,

Julien

 

 

InfoCraft
Creator
Creator

Thank you, 😂 yes I created my account in the middle of the covid19 pandemic👹 , so it was the only idea that came to my mind