Hi All,

I need help in matching the regular expression, the file is as below.

I am trying to match number followed by Number ex 587, 128 in $1 and
60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2

the $1 match works find with regulare expression  #if ($_=~
/\w{7}\s\w{4}\s\w{6}\s(\d{1,4})/i) { #workts for 1st line

However i am not sure how to get both $1 and $2 togather.

Ideally i would like to have an output printed

print "$1 wwn is $2 \n";

Any help on this would be much appreciated.


FILE
-----------------------------------------------


LOGICAL UNIT NUMBER 587
UID:                        60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11

LOGICAL UNIT NUMBER 128
UID:                        60:06:01:60:50:40:21:00:D0:23:D5:C2:BA:D9:DE:11

LOGICAL UNIT NUMBER 763
UID:                        60:06:01:60:50:40:21:00:25:C6:3F:A7:CA:2D:DF:11

-----------------------------------------------------------


#!/usr/bin/perl
open(FILE, "clrlist") || die "Can't open clrlist : $!\n";

while (<FILE>) {
#if ($_=~ /\w{7}\s\w{4}\s\w{6}\s(\d{1,4})/i) { #workts for 1st line
if ($_=~ 
/\w{7}\s\w{4}\s\w{6}\s(\d{1,4})\n[a-z0-9+]\s*(\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*\d{2}*)/i)
{
print "$1 ";
print "$2";
        }
}

---------------------

Sj

-- 
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