473,221 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

perl telnet question ($telnet->cmd)

Hi ,
I have a problem doing manipulation (like split) in string comeing back from telnet commnd :

$HOST = 'xxx';
$USER = 'yyy20';
$PASS = 'yyy-pass';
#$telnet = Net::Telnet->new($HOST);
$telnet = new Net::Telnet (Timeout => 30,
Prompt => '/[%#>] $/');
$telnet->login($USER, $PASS);

$cmdstr_GSR_logname = "ls -ta ../log/ | grep abc_efg.$HOST | head -1";
(@lines) = $telnet->cmd($cmdstr_GSR_logname); # i tried with $lines[]
@line = split (/./, $lines); # i tried with split('.',$lines)

i tried every manipulation on @lines ($lines)
i cant do split on the string comeing back.

please help
Nov 19 '06 #1
1 8510
I have a problem doing manipulation (like split) in string comeing back from telnet commnd :
If that is the problem you are having, why don't you post the content of the output rather than all that code?

$cmdstr_GSR_logname = "ls -ta ../log/ | grep abc_efg.$HOST | head -1";
(@lines) = $telnet->cmd($cmdstr_GSR_logname);
@line = split (/./, $lines);
But you haven't assigned anything to the variable $lines...

How about making Perl help you by adding
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
to the top of the program and declare the variables using my()?
Nov 19 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Yannick Turgeon | last post by:
Hello all, I'm currently trying to pass commands to a telnet session and get the texte generated (stdin + stdout) by the session. The problem I get is that the Telnet.read_until() function...
by: Shuttermutt | last post by:
Good day all! I'm looking to write a prog that sits in between a telnet client and server. In other words, the telnet client of the user's choice would connect to my prog which would, in turn,...
by: CJ | last post by:
Can someone look at the code below and tell me whats going on? Here is the problem. I can successfully telnet one of our routers and successfully put in a command in the while statement, but...
by: Kai Thorsrud | last post by:
Hi I'm currently into converting a perl linux app into a .Net windows service. The application monitors our syslog log files to capture i.p adress changes on some of our routers having dynamic...
by: iamsiju | last post by:
Hi, I am facing a problem with the Perl Telnet Object. My Telnet Object hangs just after issueing reboot command on the remote host. Please help me who faced this problem !!! Thanks in...
by: kriz4321 | last post by:
Hello all i am using net:telnet module to login to the remote machine and execute some commands and to collect some logs corresponding to the command given. After loging into the machine I do...
by: johnyboy1230987 | last post by:
I am running my perl on linux trying to connect to window via telnet. How can I overcome the "Mode:" prompt? as you know when you telnet a window box you will be prompted with "Mode" I tried...
by: abdulbca | last post by:
Hi, I am trying to execute a simple perl script, i have installed net::telnet module. I have many perl scripts and all are running fine, except this first perl script i m trying to write for net...
by: Kalpesh Katwala | last post by:
hi All, I've a small script, parses thru an array, gets input from it and executes a telnet command on a unix server. I want to start these command in the background on the remote unix server...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.