Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I made a Expect - script to automate the process in communication Boxes. Login : User ID / Pwd and entering into the box is done but I stuck with the problem if once the pattern match then only next command will process.
As an instance :
below command will run in automatic manner after login into the box
rtrv-crs-sts1::4-2-2:xyz;
and then provide the output on prompt like below
IP sk5829
SBTNVTDPFOMG 13-03-04 18:07:55
M SK5829 COMPLD
"4-2-2,1-17:::,"
"4-2-2,2-17:::,"
I need to catch here 4-2-2,1-17:,4-2-2,2-17:in this manner so that in next command I can use them.
Please suggest me how to catch both output.
You can then use this VAL variable in next command as $VAL.
Hope this will help, if I understood your requirement properly.
Thanks Shiva for Such a nice suggestion. In some term I can use this like If I will dump all my input in a file the grep the
Pattern 4-2-2,1-17:::, and then use your suggested command.
But In my problem I am into the live BOX and it is throughing out the output on shell
rtrv-crs-sts1::4-2-2:xyz;
and then provide the output on prompt like below
IP sk5829
SBTNVTDPFOMG 13-03-04 18:07:55
M SK5829 COMPLD
"4-2-2,1-17:::,"
"4-2-2,2-17:::,"
--------------
---------------
--more output on prompt.
here in live action i need to catch the pattern "4-2-2,1-17:::,"and take into varaible.
To be honest, your example isn't at all clear & leads to more confusion.
Which command you're running and how are you providing input to that command? Why you want to catch 4-2-2,1-17:::," and where this value will be used. Please make it little more clear. And can't you do like this?
Let me more clear on my point.
This script is to automate the Communication Box process. Here I need to login into the box from remote location with telnet via IP address.
There are some certain set of commands which are needed to be through into the box one by one as per process.So in between this process when I am retrieving the logicals with automation by using command rtrv-crs-sts1::4-2-2:xyz; where <4-2-2> is provided input from comand line only.
it provides the output
IP sk5829
SBTNVTDPFOMG 13-03-04 18:07:55
M SK5829 COMPLD
"4-2-2,1-17:::,"
"4-2-2,2-17:::,"
immidiately in second line i need to handle the output and use this for another command.
I hope this may clear little bit. Hope for fruitfull result.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.