Search Results

Search: Posts Made By: ahmed_zaher
18,141
Posted By ahmed_zaher
Many thanks for your support. It works fine...
Many thanks for your support.

It works fine with my simple example but I unfortunatly I still don't know how to make it for my actual script.

I want to run some cisco commands after checking...
18,141
Posted By ahmed_zaher
Perl: One action if an element doesn't exist in array
Hello,


I want to run one (not multiple) action if an element doesn't exist in array.
for example:


@array = (1..10);
foreach $el (@array)
{
if ($el != 11)
{
print "number not...
1,843
Posted By ahmed_zaher
Thanks for your reply. Sorry I am a...
Thanks for your reply.

Sorry I am a beginner in perl, I have ($word = "Port-channel24";).

then how to use your code to put only the number in another variable???

Thanks,
Ahmed
1,843
Posted By ahmed_zaher
Perl Cutting character(s) from a word
Hello,

How to cut a char(s) for a word using perl??

I want to cut the number(s) from these sample words:

Port-channel24
Po78
Po99
Port-channel34


$word = "Port-channel24";

...
7,871
Posted By ahmed_zaher
Many thanks for your swift response. I mean...
Many thanks for your swift response.

I mean 2nd word, 3rd word, 4th word, .. ,etc

for example, how to parse "1476" form "ip mtu 1476"
or "10.14.2.0" from "ip summary-address eigrp 1...
7,871
Posted By ahmed_zaher
Many thanks for your support. it works fine...
Many thanks for your support.

it works fine but after adding $\ = $, = "\n";
as per your advice.

but how to specify the 3rd or 4th ,.., etc for each line.

appreaciate your reply.\
...
7,871
Posted By ahmed_zaher
Perl Parse word from command output
Hello,

I used the following script to conect to cisco router:
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Opsware::NAS::Connect;
my($host, $port, $user, $pass) =...
3,109
Posted By ahmed_zaher
Code for one array
Many thanks Radoulov,

the following code is working well:


Could you please provide the code for only one array?

Thanks in advance.
3,109
Posted By ahmed_zaher
Thanks again, I still have the same output...
Thanks again,

I still have the same output after changing the last element of 2nd array from "56" to "55" to make all have the same value but unfortunatly i got the same output:

...
3,109
Posted By ahmed_zaher
Many thanks for swift response. It works...
Many thanks for swift response.

It works without errors, but where should I put the actions if all elements have the same value?
and if they don't?

Also I tried to change the value of one...
3,109
Posted By ahmed_zaher
Thanks for your reply. I am beginner in...
Thanks for your reply.

I am beginner in perl, but do you confirm that this code is written in perl?
I got many error when I execute it.

Please advise,
Ahmed
3,109
Posted By ahmed_zaher
Perl Array Condition
Hello,

I want to check if all element of an array have the same value regardless the length of the array.

example:
@array1 = qw(44 44 44 44);
@array2 = qw(55 55 55 55 55 55 55);

Please...
12,191
Posted By ahmed_zaher
Hello, Many thanks for your support. ...
Hello,

Many thanks for your support.

It works well and I got the both Fa0/0 and Fa0/4.

but as I mentioned first, I want to run a differnt actions for both output (action if element in...
12,191
Posted By ahmed_zaher
Perl Compare 2 Arrays
Hello,

Consider the following 2 arrays:

Array1 = qw(Fa0/0 Fa0/1 Fa0/2 Fa0/3);
Array1 = qw(Fa0/1 Fa0/2 Fa0/3 Fa0/4);


I want to compare the following 2 arrays as follows:

Take...
1,714
Posted By ahmed_zaher
Perl Array Elements Replacement
Hello,

I have the following perl array:
@longname = (Fasthernet0/0 Fasthernet0/1 Serial0/1/0 Serial0/2/1 Tunnel55 Tunnel77)

with the followinh array:
@shortname = (Fa0/0 Fa0/1 Se0/1/0...
1,609
Posted By ahmed_zaher
Hello, I would like to thank you very much...
Hello,

I would like to thank you very much for your support.

it needs a list not a scalar as you menetion.

But do you know , why it considers "sh run | in distribute" an element of the...
1,609
Posted By ahmed_zaher
Perl Foreach add "4" to the end of each element
I wrote the following script configuring cisco router:#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Opsware::NAS::Connect;
my @IP = split(/\./,"$tc_device_ip$");
my $O3 =...
11,308
Posted By ahmed_zaher
Thanks for your interest. I have active...
Thanks for your interest.

I have active perl 5.8.9 on windows but I don't find the "Net::Telnet::Cisco" module by default so I download only "Cisco.pm" file and paste it in perl. (it seems that...
11,308
Posted By ahmed_zaher
Hello, Thanks for your reply, it work fine...
Hello,

Thanks for your reply, it work fine but I have another problem.

this the whole script:

use Net::Telnet::Cisco;
$device = "10.14.199.1";
($o1, $o2, $o3, $o4) = split(/\./,$device);...
11,308
Posted By ahmed_zaher
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...
3,756
Posted By ahmed_zaher
Hello Aia, I would like to thank you very...
Hello Aia,

I would like to thank you very much for your interest.

it works fine with me but now, I want RE to match "Serial0" or "Serial0/0" or "Serial0/0/0".

could you please help me to...
3,756
Posted By ahmed_zaher
Regular Expression doesn't match dot "." in a string
hello,

I am writting a regular expression that intend to match any tunnel or serial interface but it doesn't mtach any serial sub-interface.

For example, statement should match "Tunnel3" or...
11,918
Posted By ahmed_zaher
#!C:\Perl\bin print "Prepare the \"nodes.txt\"...
#!C:\Perl\bin
print "Prepare the \"nodes.txt\" file in drive C then press enter:";
$enter = <>;
print "\n";
if ($enter == "\r")
{
print "Enter the parent node group name: ";
$group = <>;...
11,918
Posted By ahmed_zaher
Thank Mark. When I replaced the exec with...
Thank Mark.
When I replaced the exec with system, the script didn't sense some options of the executed command.

I got the following error:
ERROR: (NDUT9005) Option -caption missing.
...
11,918
Posted By ahmed_zaher
Dear Mark, Thank you very much for your...
Dear Mark,

Thank you very much for your reply.

The code worked well and the variables are passed.

But as you made sense I add nodes to an application which are listed in a file.
...
Showing results 1 to 25 of 26

 
All times are GMT -4. The time now is 09:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy