on Thu, 01 Aug 2002 16:15:33 GMT, Nkuipers wrote:
> Could you please elaborate on the nested character-class brackets and
> colon use, or point me in the right direction; I am not familiar with
> that notation.
Search
perldoc perlre
for 'POSIX character class syntax' for an explanation
>perl -lne'/^[[:xdigit:]]{4}(?:\.[[:xdigit:]]{4}){2}$/&&print' yourfile
>From the original question, I believe that the desired target is
0008.0e39.ad80
and lines like it in the file. From your regex, I understand the anchors, and
the quantifiers, and the clustering without capturing. Could
Ernie Tucker wrote:
>
> I have a file with the following data in it. What I am trying to do is just
> grab the mac id. Is there a good way to do this in perl. I tried to grep on
> just 00 but that gave me more info than what I need. Thanks for any help.
>
> 0008.0e39.ad80
> Account: 1039
How about something like this?
$_ =~ /([0-9A-F]{4}\.[0-9A-F]{4}\.[0-9A-F]{4}\.[0-9A-F]{4})/i
$mac = $1;
#matches four sets of 4 characters between 0 and 9 or A and F separated by
periods
-Original Message-
From: Tucker, Ernie
To: [EMAIL PROTECTED]
Sent: 7/31/02 9:26 PM
Subject: Need