Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 2008 10:51:18 +0200
From:      Peter Boosten <peter@boosten.org>
To:        freebsd-questions@freebsd.org
Cc:        Martin McCormick <martin@dc.cis.okstate.edu>
Subject:   Re: Regular Expression Trouble
Message-ID:  <48B66706.9060303@boosten.org>
In-Reply-To: <20080827152900.GB30783@it.ca>
References:  <200808271325.m7RDP28b044255@dc.cis.okstate.edu> <20080827152900.GB30783@it.ca>

next in thread | previous in thread | raw e-mail | index | archive | help


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48B66706.9060303>