Re: How to capture telnet output using shell/perl script ?? (466 Views)
Reply
Advisor
Praveen Hari
Posts: 32
Registered: ‎08-27-2003
Message 1 of 4 (466 Views)
Accepted Solution

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
Honored Contributor
Jean-Luc Oudart
Posts: 1,461
Registered: ‎03-10-1998
Message 2 of 4 (466 Views)

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
Advisor
Praveen Hari
Posts: 32
Registered: ‎08-27-2003
Message 3 of 4 (466 Views)

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

It worked. Thanks.
Honored Contributor
John Dvorchak
Posts: 682
Registered: ‎02-19-2001
Message 4 of 4 (466 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.