Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > nawk doesn't ma...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 2165 of 2234
Post > Topic >>

nawk doesn't match mac addresses with quantifiers

by Robert Langdon <Not@[EMAIL PROTECTED] > Feb 14, 2008 at 12:00 AM

Dear Community,

Using quantifiers as shown in the code below doesn't match mac 
addresses from the input file.

Neither...

#!/usr/bin/nawk -f
/([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])/ {
  print $1
}

nor

#!/usr/bin/nawk -f
/[0-9a-fA-F][0-9a-fA-F]:{5}[0-9a-fA-F][0-9a-fA-F]/ {
  print $1
}

match any line.

cat input_file.lst
00:01:96:b5:bb:ab  ANYTEXTA         Associated     7     Yes   802.11b  
29
00:03:66:aa:c2:02  ANYTEXTB         Associated     4     No    802.11b  
29
00:11:cf:df:65:66  ANYTEXTC         Associated     4     No    802.11b  
29
00:f0:f8:00:67:33  ANYTEXTD         Associated     4     No    802.11b  
29

The code below, without quantifiers, match the mac address properly.
#!/usr/bin/nawk -f
/[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]/

{
  print $1
}

Any ideas how to create a proper pattern with quantifiers to match a 
mac address?

Thanks in advance.

Robert




 6 Posts in Topic:
nawk doesn't match mac addresses with quantifiers
Robert Langdon <Not@[E  2008-02-14 00:00:27 
Re: nawk doesn't match mac addresses with quantifiers
Ed Morton <morton@[EMA  2008-02-13 20:27:05 
Re: nawk doesn't match mac addresses with quantifiers
Robert Langdon <not@[E  2008-02-15 09:14:31 
Re: nawk doesn't match mac addresses with quantifiers
gazelle@[EMAIL PROTECTED]  2008-02-15 14:09:11 
Re: nawk doesn't match mac addresses with quantifiers
usenetpersongerryt@[EMAIL  2008-02-15 08:46:30 
Re: nawk doesn't match mac addresses with quantifiers
gazelle@[EMAIL PROTECTED]  2008-02-15 20:01:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun May 11 18:03:05 CDT 2008.