Re: Regular Expression Trouble

2008-08-28 Thread Peter Boosten
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

Re: Regular Expression Trouble

2008-08-27 Thread Wayne Sierke
On Tue, 2008-08-26 at 22:12 -0500, 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

Re: Regular Expression Trouble

2008-08-27 Thread Martin McCormick
My thanks to several people who have provided great suggestions and an apology for not being clear on the log data I am mining for MAC addresses. It is syslog and a typical line looks like: Aug 26 20:45:36 dh1 dhcpd: DHCPACK on 10.198.67.116 to 00:12:f0:88:97:d6 (peaster-laptop) via 10.198.71.246

Re: Regular Expression Trouble

2008-08-27 Thread Jonathan McKeown
On Wednesday 27 August 2008 15:25:02 Martin McCormick wrote: The sed pattern matching system is interesting because I can think of several similar situations in which the data are there but there is no guarantee where on a given line it sits and grep or sed usually will pull in the

Re: Regular Expression Trouble

2008-08-27 Thread Wayne Sierke
On Wed, 2008-08-27 at 08:25 -0500, Martin McCormick wrote: My thanks to several people who have provided great suggestions and an apology for not being clear on the log data I am mining for MAC addresses. It is syslog and a typical line looks like: Aug 26 20:45:36 dh1 dhcpd: DHCPACK on

Re: Regular Expression Trouble

2008-08-27 Thread Paul Chvostek
Hi Martin. On Wed, Aug 27, 2008 at 08:25:02AM -0500, Martin McCormick wrote: Aug 26 20:45:36 dh1 dhcpd: DHCPACK on 10.198.67.116 to 00:12:f0:88:97:d6 (peaster-laptop) via 10.198.71.246 That was one line broken to aid in emailing, but that's what types of lines are involved. The MAC

Re: Regular Expression Trouble

2008-08-27 Thread Martin McCormick
Paul Chvostek writes: While I agree with others that awk should be used with explicit recognition of the particular lines, you can still snatch everything with sed if you want to. In FreeBSD, sed supported extended regex, so: sed -nE 's/.*([0-9a-f]{2}(:[0-9a-f]{2}){5}).*/\1/p'

Regular Expression Trouble

2008-08-26 Thread Martin McCormick
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 am doing

Re: Regular Expression Trouble

2008-08-26 Thread Paul A. Procacci
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

Re: Regular Expression Trouble

2008-08-26 Thread Bill Campbell
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

Re: Regular Expression Trouble

2008-08-26 Thread N. Raghavendra
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

Re: Regular Expression Trouble

2005-12-12 Thread Martin McCormick
Parv writes: For even finer results, use word boundaries ... egrep '\bIN[^[:alnum:]]+A\b' file egrep '\IN[[:space:]]+A\' file I sincerely thank all for your examples which I have saved for future reference. The word boundary test appears to work perfectly, but after looking at all

Regular Expression Trouble

2005-12-09 Thread Martin McCormick
After reading a bit about extended regular expressions and having a few actually work correctly in sed scripts, I tried one in egrep and it isn't working although there are no errors. I was hoping to get only the A records from a dns zone file so the expression I used is: egrep

Re: Regular Expression Trouble

2005-12-09 Thread Andrew P.
On 12/10/05, Martin McCormick [EMAIL PROTECTED] wrote: After reading a bit about extended regular expressions and having a few actually work correctly in sed scripts, I tried one in egrep and it isn't working although there are no errors. I was hoping to get only the A

Re: Regular Expression Trouble

2005-12-09 Thread Glenn Dawson
At 02:12 PM 12/9/2005, Martin McCormick wrote: After reading a bit about extended regular expressions and having a few actually work correctly in sed scripts, I tried one in egrep and it isn't working although there are no errors. I was hoping to get only the A records from a

Re: Regular Expression Trouble

2005-12-09 Thread Parv
in message [EMAIL PROTECTED], wrote Glenn Dawson thusly... At 02:12 PM 12/9/2005, Martin McCormick wrote: I was hoping to get only the A records from a dns zone file so the expression I used is: egrep [[:space:]IN[:space:]A[:space:]] zone_file h0 Had it worked, all that

Re: Regular Expression Trouble

2005-12-09 Thread Tim Hammerquist
Martin McCormick wrote: After reading a bit about extended regular expressions and having a few actually work correctly in sed scripts, I tried one in egrep and it isn't working although there are no errors. I was hoping to get only the A records from a dns zone file so the expression I