Need Help on "waitfor" command in net::Telnet Module in PERL


 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Need Help on "waitfor" command in net::Telnet Module in PERL
# 1  
Old 01-27-2009
Need Help on "waitfor" command in net::Telnet Module in PERL

Hi,
Can anybody help me in writing command "waitfor" for string
"C:\WINNT\Profiles\mfcf0508>" while using net::Telnet module.
I tried the below format :

$telnet->waitfor('/"C\:\WINNT\Profiles\mfcf0508>".*$/i');
Getting error as : pattern match timed-out
Plz help me
# 2  
Old 01-27-2009
Quote:
Originally Posted by sudhakaryadav
Hi,
Can anybody help me in writing command "waitfor" for string
"C:\WINNT\Profiles\mfcf0508>" while using net::Telnet module.
I tried the below format :

$telnet->waitfor('/"C\:\WINNT\Profiles\mfcf0508>".*$/i');
Getting error as : pattern match timed-out
Plz help me
Try doubling up the backslashes, Perl may be interpreting them as (bad) escape sequences. Also, you've got a c\:\ there, perhaps you meant c:? And are the double-quotes really necessary?
# 3  
Old 01-29-2009
Tried by putting double back slashes and removing double quotes .
Still iam getting "pattern match timed-out at ./bsc.pl line 20" error.

$telnet->waitfor('/C:\\WINNT\\Profiles\\mfcf0508\\>.*$/i');

original string : C:\WINNT\Profiles\mfcf0508>
# 4  
Old 01-29-2009
Quote:
Originally Posted by sudhakaryadav
Tried by putting double back slashes and removing double quotes .
Still iam getting "pattern match timed-out at ./bsc.pl line 20" error.

$telnet->waitfor('/C:\\WINNT\\Profiles\\mfcf0508\\>.*$/i');
What is the .*$ there for? It seems superfluous unless you really need to match the entire line. For that matter, does it even need to be a regex? waitfor is supposedly capable of waiting for simple strings. $telnet->waitfor("C:\\WINNT\\Profiles\\mfcf0508\\>");

What I often do when debugging regexes is simplify them greatly, then add more to the end until they stop working. See if you can get it to match "c:\\", then add more until you find the point it breaks at.

$telnet->dump_log(); may also be useful should the remote server turn out to not be sending precisely what you think it is.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

2. Shell Programming and Scripting

Perl: errors during "install Net::SSLeay"

Hi, Here is the errors: Any help will be greatly appreciated! (4 Replies)
Discussion started by: aixlover
4 Replies

3. Shell Programming and Scripting

Unable to Install "Devel-Profile" perl module in windows.

Hi, I want to install 'Devel-Profile' in windows but i am not able to install. Here is the error. PPM> install Devel-Profile Install package 'Devel-Profile?' (y/N): y Installing package 'Devel-Profile'... Error installing package 'Devel-Profile': Could not locate a PPD file for... (3 Replies)
Discussion started by: vanitham
3 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Perl variables inside Net::Telnet::Cisco Module doesn't work

I am writing perl script to configure Cisco device but Variables inside Net::Telnet::Cisco Module doesn't work and passed to device without resolving. Please advise. here is a sample of script: use Net::Telnet::Cisco; $device = "10.14.199.1"; ($o1, $o2, $o3, $o4) = split(/\./,$device);... (5 Replies)
Discussion started by: ahmed_zaher
5 Replies

6. Shell Programming and Scripting

Pressing "Enter/Space bar" using Net::TELNET? in Perl

I'm trying to learn how to get my script to execute the enter button when it telnets into a router and the router displays output but you need to press the space bar or enter button to continue displaying my output of the router. How is this done? (0 Replies)
Discussion started by: xmaverick
0 Replies

7. Infrastructure Monitoring

HPUX net-SNMP interpreter "/bin/perl" not found

I am trying to install net-snmp on an HPUX box. I am getting the fallowing error message when I try to run the snmpconf file. I installed the fallowing version of net-snmp net-snmp-5.0.10.2-HP-UX_B.11.11_9000_800.tar and my HPUX box is version HP-UX commnms B.11.11 U 9000/800... (2 Replies)
Discussion started by: krisarmstrong
2 Replies

8. Shell Programming and Scripting

Need help on "Net::SMPP" Module

Hi all, I have installed Net::SMPP module in my system and i want to send SMS using SMPP account. Please help me how to write the script for the same using Net::SMPP module. (0 Replies)
Discussion started by: sudhakaryadav
0 Replies

9. Shell Programming and Scripting

Need help on use of "cmd" command in net::Telnet module in PERL

in "cmd" command i want to copy the ouput of the command excuted to a particular file in a directory. How to do this..?? Ex : $telnet->cmd(String => 'allip:acl=a1;',Prompt => '/</'); i want to copy o/p of the command "allip:acl=a1;" in a log file in a particular directory. Plz suggest.. (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

10. Shell Programming and Scripting

Need Help on "waitfor" command in net::Telnet Module

Hi, Can anybody help me in writing command "waitfor" for string "C:\WINNT\Profiles\mfcf0508>" while using net::Telnet module. I tried the below format : $telnet->waitfor('/"C\:\WINNT\Profiles\mfcf0508>".*$/i'); Getting error as : pattern match timed-out Plz help me (1 Reply)
Discussion started by: sudhakaryadav
1 Replies
Login or Register to Ask a Question