473,508 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

perl telnet question ($telnet->cmd)

1 New Member
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->login($USER,$PASS);
$telnet = new Net::Telnet (Timeout => 30,
Prompt => '/[%#>] $/');
$telnet->open($HOST);
$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 8527
GunnarH
83 New Member
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

3
8643
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...
0
3827
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,...
0
7257
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...
2
6997
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...
3
4001
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...
2
4842
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...
2
2663
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...
1
2524
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...
1
2309
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...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.