Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture telnet output using shell/perl script ??

SOLVED
Go to solution
Praveen Hari
Advisor

How to capture telnet output using shell/perl script ??

Hi,

We have a newsgroup running at forums.sybase.com.
We can find the all newsgroups and number of messages in each group by executing following commands:

telnet test.com 119

this command will connect to test.com. Then you can execute "list" and get the list of Newsgroups with message numbers.
Then you can execute "quit" to quit telnet session.

I want to capture the output of "list" command.
Is it possible to do this ??
Thanks
3 REPLIES
Jean-Luc Oudart
Honored Contributor
Solution

Re: How to capture telnet output using shell/perl script ??

Try "telnet server | tee spoolfielname"
when back brow your spool file
I suppose you will get some escape sequences.

Hope this Help

Rgds,
JL
fiat lux
Praveen Hari
Advisor

Re: How to capture telnet output using shell/perl script ??

It worked. Thanks.
Highlighted
John Dvorchak
Honored Contributor

Re: How to capture telnet output using shell/perl script ??

You could also use the script command, man script. That takes everything and puts it to a named file:

script /tmp/your_output_filename

or if you want to append to that same file:

script -a /tmp/your_output_filename

It may give you cleaner output.
If it has wheels or a skirt, you can't afford it.