monicak Absent Member.
Absent Member.
520 views

Display output of a shell command

Hi ,

I am loggin on to SSH Shell and sending commands to server to execute python script.

send sudo su - root
expectEndsWith :
send ${password}
expectEndsWith #
send cd /tmp/puppet1
expectEndsWith #
send python ./hpoo_script1.py

the output of my pyhton script is a list of servers with comma separated eg.

xxxxxx.com,xxxxxxx.com,xxxxxxx.com,

when I'm trying to use display message to see the output of my python script I see the output see and also the prompt on the server

xxxxxx.com,xxxxxxx.com,xxxxxxx.com,

 xxxxxxx01:/tmp/puppet1 #

How can I just diplay the output of my script getting rid of the last line " xxxxxxx01:/tmp/puppet1 #"

Labels (2)
Tags (2)
0 Likes
1 Reply
Super Contributor.. Chuck Perilli Super Contributor..
Super Contributor..

Re: Display output of a shell command

If you only want lines with commas, try this RegEx results filter:

^.*[,].*$

 

 

regex.jpg

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.