Hi All,

I have the below program. i can match the entries in actzone.txt file in
bluealias.txt and print it.

what i would like to achive is to print the alias name and the reated wwn
for each zone that matched in 2 formats in different file ex. as below.
Please could you help me achieve this.


outputfile1
------------

zone :           tstdetdr_B_AARA_30767_CL45
alias:            tstdetdr_B_AARA
                     10:00:00:00:c7:d5:cd:16:c6
alias:            30767_CL45
                     50:00:00:08:44:9a:fb:64:90

outputfile2
--------------

zone : tstdetdr_B_AARA_30767_CL45, alias : tstdetdr_B_AARA,
10:00:00:00:c7:d5:cd:16:c6,alias: 30767_CL45, 50:00:00:08:44:9a:fb:64:90

----

#!/usr/bin/perl

use strict;
use warnings;

my (@all, @actzone);

open (FILE, "bluealias.txt") || die "can't open alias $! \n";
while (<FILE>) {
s/\s+//g;
push @all,$_;
}
chomp @all;

open (FILE, "actzone.txt" ) || die "can't open zone: $! \n";
while (<FILE>) {
s/\s+//g;
push @actzone,$_;
}
chomp @actzone;

for my $zone (@actzone) {
chomp $zone;
for my $all (@all) {
chomp $all;
if ($zone =~ $all) {
print "$all \n";
#print "$`";
}
}
}

--
file: bluealias.txt

zone:            tstdetdr_B_AARA_30767_CL45
zone:            artdetdr_B_AARA_30767_CL45
zone:            dbtdetdr_B_AARA_30767_CL45
zone:            tstdetdr_B_AARA_30767_CL45
                     10:00:00:00:c7:d5:cd:16:c6
                     50:00:00:08:44:9a:fb:79:90
zone:            artdetdr_B_AARA_30767_CL45
                     10:00:00:00:c7:d5:cd:16:c9
                     50:00:00:08:44:9a:fb:64:90
zone:            dbtdetdr_B_AARA_30767_CL45
                     10:00:00:00:c7:d5:cd:16:ca
                     50:00:00:08:44:9a:fb:74:90
zone:            tstdetdr_B_AARA_30767_CL45
                 tstdetdr_B_AARA,30767_CL45
zone:            artdetdr_B_AARA_30767_CL45
                 artdetdr_B,AARA_30767_CL45
zone:            dbtdetdr_B_AARA_30767_CL45
                 dbtdetdr_B,AARA_30767_CL45
alias:            tstdetdr_B_AARA
                     10:00:00:00:c7:d5:cd:16:c6
alias             30767_CL45
                     50:00:00:08:44:9a:fb:64:90
alias:            artdetdr_B_AARA
                     10:00:00:00:c7:d5:cd:16:c9
alias:            AARA_30767_CL45
                     50:00:00:08:44:9a:fb:64:90

---

file: actzone.txt

zone:            tstdetdr_B_AARA_30767_CL45
zone:            artdetdr_B_AARA_30767_CL45

---

Reply via email to