How about this? # untested my @mac = map {/((?:[a-fA-F0-9]{4}\.){2}[a-fA-F0-9]{4})/ and $1} ( @offline );
Rob -----Original Message----- From: Tucker, Ernie [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 11:37 AM To: Hanson, Robert; Tucker, Ernie; [EMAIL PROTECTED] Subject: RE: parsing a variable thanks is there any other ways to do this. What I would like to do is something like the following. I would like to grep out the second column which is the mac id and store it into a variable called @mac. Any help would be great. I am have brain drain. Ernest P. Tucker II Network Technician "The organization that can't communicate can't change, and the corporation that can't change is dead." --Nido Qubein -----Original Message----- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 10:00 AM To: 'Tucker, Ernie'; [EMAIL PROTECTED] Subject: RE: parsing a variable Here is one solution... For each item in @offline the MAC will be captured in the variable $1. # untested... for ( @offline ) { if ( /((?:[a-fA-F0-9]{4}\.){2}[a-fA-F0-9]{4})/ ) { print "MAC: $1\n"; } else { print "No MAC here\n"; } } Rob -----Original Message----- From: Tucker, Ernie [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 10:39 AM To: [EMAIL PROTECTED] Subject: parsing a variable I have a global variable name @offline. It has the following information stored in the variable. What I need to do is parse or split the variable and store the mac id in a variable . What is the proper way to do this? Cable3/0/U0 0020.4098.43fc 944 online Jun 13 14:09:56 0.00 32.56 5 Cable3/0/U0 0020.4095.2078 1104 online Jun 14 05:21:28 0.25 34.23 79 Cable3/0/U0 0020.409a.e2c0 1111 init(r2) Jun 9 22:06:21 !-10.00 33.64 60 Cable3/0/U0 0020.402d.4e5c 2902 online Jun 13 20:10:26 -0.25 34.18 26 Cable3/0/U0 0020.40a3.92fc 3017 online Jun 13 22:23:55 -0.50 33.95 12 Cable3/0/U0 0020.404d.1e60 3058 online Jun 13 14:56:26 -0.75 33.40 3 Cable3/0/U0 0004.bd01.0120 3077 online Jun 13 19:36:15 -0.25 33.94 2 Cable3/0/U0 0020.404d.255e 3081 online Jun 13 17:08:14 -0.25 32.96 1 Ernest P. Tucker II Network Technician "The organization that can't communicate can't change, and the corporation that can't change is dead." --Nido Qubein "The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers." "The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]