Iam trying to connect to the remote Linux machine from the Windows box using the Perl module use Net::Telnet.The following is the code,
[CODE=perl]use Net::Telnet;
$telnet = new Net::Telnet (Timeout=>10,Er rmode=>'die');
$telnet->open('hostname ');
$telnet->waitfor('/login: $/i');
$telnet->print('usernam e');
$telnet->waitfor('/password for tsom31: $/i');
$telnet->print('passwor d');
@r=$telnet->cmd('who');
print @r;[/CODE]
It gives the output as shown below,
From the output i should remove the Last Prompt
for ex:[tsom31@tsom31 ~]
please some one help me in this
Thanks in advance........ ..
Regard's
Thamayanthi
[CODE=perl]use Net::Telnet;
$telnet = new Net::Telnet (Timeout=>10,Er rmode=>'die');
$telnet->open('hostname ');
$telnet->waitfor('/login: $/i');
$telnet->print('usernam e');
$telnet->waitfor('/password for tsom31: $/i');
$telnet->print('passwor d');
@r=$telnet->cmd('who');
print @r;[/CODE]
It gives the output as shown below,
Code:
who login: Resource temporarily unavailable while getting initial credentials Last login: Thu Mar 6 10:20:30 from 192.168.*.* [tsom31@tsom31 ~]$ who root :0 Mar 4 07:35 root pts/3 Mar 6 07:46 (192.168.*.*) tsom31 pts/4 Mar 6 10:21 (192.168.*.*) root pts/2 Mar 6 07:29 (:0.0) [tsom31@tsom31 ~]
for ex:[tsom31@tsom31 ~]
please some one help me in this
Thanks in advance........ ..
Regard's
Thamayanthi
Comment