gctaylor1 has asked for the wisdom of the Perl Monks concerning the following question:
Here's my code:
Which produces this output:#!/usr/bin/perl use strict; use warnings; use Net::Telnet (); my $t = new Net::Telnet (Timeout => 10, Prompt => '/host\@user ~\/'); my ($username, $passwd) = qw(user password); $t->open("host"); $t->login($username, $passwd); my @distro = $t->cmd(String => "cat /etc/redhat-release", cmd_remove_mode => '1'); print "@distro";
$ ./connect.pl $ cat /etc/redhat-release CentOS release 5 (Final)
and I don't want the cat command. Can anyone shed some light?
UPDATE:
Set cmd_remove_mode to the number of lines to remove such as
my @distro = $t->cmd(String => "cat /etc/redhat-release", cmd_remove_mode => '2');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can't get cmd_remove_mode to work in Net::Telnet
by vek (Prior) on Jan 15, 2009 at 21:38 UTC | |
by gctaylor1 (Hermit) on Jan 15, 2009 at 21:44 UTC | |
by leriksen (Curate) on Jan 15, 2009 at 23:11 UTC |