Regular Expression Trouble
    Peter Boosten 
    peter at boosten.org
       
    Thu Aug 28 08:51:23 UTC 2008
    
    
  
Paul Chvostek wrote:
>> 	This is an attempt to isolate every MAC address that
>> appears and then sort and count them to see who is having
>> trouble or, in some cases, is causing trouble.
> 
> Then you still may want to use awk for some of that...
> 
> 	cat /var/log/dhcpd.log | \
> 	sed -nE 's/.*([0-9a-f]{2}(:[0-9a-f]{2}){5}).*/\1/p' | \
> 	awk '
> 	 { a[$1]++; }
> 	 END {
> 	  for(i in a){
> 	   printf("%7.0f\t%s\n", a[i], i);
> 	  }
> 	 }
> 	' | sort -nr
> 
Euhmm:
sed -nE 's/.*([0-9a-f]{2}(:[0-9a-f]{2}){5}).*/\1/p' /var/log/dhcpd.log|\
sort | uniq -c
:-)
Peter
-- 
http://www.boosten.org
    
    
More information about the freebsd-questions
mailing list