Date: Wed, 27 Aug 2008 09:43:45 +0530 From: "N. Raghavendra" <raghu@mri.ernet.in> To: Martin McCormick <martin@dc.cis.okstate.edu> Cc: freebsd-questions@freebsd.org Subject: Re: Regular Expression Trouble Message-ID: <86od3f14ee.fsf@riemann.mri.ernet.in> In-Reply-To: <200808270312.m7R3CJNk076060@dc.cis.okstate.edu> (Martin McCormick's message of "Tue, 26 Aug 2008 22:12:19 -0500") References: <200808270312.m7R3CJNk076060@dc.cis.okstate.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
At 2008-08-26T22:12:19-05:00, Martin McCormick wrote: > I am trying to isolate only the MAC addresses that appear in > dhcpd logs. > For anyone who is interested, the sed construct that should do > this looks like: It'd be better if you post a few relevant lines of the log file. Pending that, I suggest awk(1) in case the log file format is similar to the following snippet of `dhcpd.leases' on an OpenBSD server: % cat dhcpd.leases lease 192.168.10.216 { starts 3 2008/07/16 23:17:29; ends 4 2008/07/17 00:17:29; tstp 4 2008/07/17 00:17:29; binding state free; hardware ethernet 00:1f:c6:81:66:a6; } lease 192.168.10.65 { starts 4 2008/07/17 11:15:48; ends 5 2008/07/18 11:15:48; tstp 5 2008/07/18 11:15:48; binding state free; hardware ethernet 00:16:d3:9e:eb:74; } % awk '/hardware ethernet/ { print substr($3, 4, 14) }' dhcpd.leases 1f:c6:81:66:a6 16:d3:9e:eb:74 Raghavendra. -- N. Raghavendra <raghu@mri.ernet.in> | http://www.retrotexts.net/ Harish-Chandra Research Institute | http://www.mri.ernet.in/ See message headers for contact and OpenPGP information.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86od3f14ee.fsf>