On Tue, Aug 26, 2008, 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: > > sed 's/.*\([[ your regular expression ]]\).*/\1/' > >The \1 tells sed to only print what matched and skip all the rest. >
I just tried this, and it worked: sed -n 's;.* to \([0-9:a-z]*\) via.*;\1;p' logfile It would have been easier in perl or python where one could use the pattern '.* to (\S+) via.*'. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 My reading of history convinces me that most bad government results from too much government. --Thomas Jefferson. _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"