Chaps,

Thanks for all your comments, I am strill trying to resolve my inital
query. Any help would be much appreciated.


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

---

Thanks
Sj

On Fri, Aug 17, 2012 at 3:52 PM, Shawn H Corey <shawnhco...@gmail.com>wrote:

> On Fri, 17 Aug 2012 15:10:03 +0100
> jet speed <speedj...@googlemail.com> wrote:
>
> > > Your code is lacking indentation.
>
> Perhaps you should consider using Perl::Tidy to automatically format
> your code.
>
> http://search.cpan.org/~shancock/Perl-Tidy-20120714/lib/Perl/Tidy.pm
>
>
> --
> Just my 0.00000002 million dollars worth,
>   Shawn
>
> Programming is as much about organization and communication
> as it is about coding.
>
>         _Perl links_
> official site   : http://www.perl.org/
> beginners' help : http://learn.perl.org/faq/beginners.html
> advance help    : http://perlmonks.org/
> documentation   : http://perldoc.perl.org/
> news            : http://perlsphere.net/
> repository      : http://www.cpan.org/
> blog            : http://blogs.perl.org/
> regional groups : http://www.pm.org/
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to