Grep command
hello guys, i have this pattern of logs which is kinda long and huge..
[08/Jan/2010 17:16:36] Result: delivered, Status: 2.0.0 , Remote-Host: 127.0.0.1, Msg-Id: <-asz@unknown.net> [07/Feb/2014 17:16:36] Result: delivered, Status: 2.0.0 , Remote-Host: 127.0.0.1, Msg-Id: <-asz@unknown.net> I tried to filter using this grep command: grep -E 'asz|07/Feb/2014' list.log I basically want to filter asz for the date of 07/Feb/2014. But the results includes 2010 to 2014. How do I use grep to filter the word "asz" for a particular date specified on the command? Thank you. |
From (fuzzy) memory, in your expression asz|07/Feb/2014 the | acts as "or" not "and"
You could try 07/Feb/2014.*asz instead |
There's probably a smart way with a single grep, but I don't know it, so I just pipe it to a second grep.
|
Quote:
|
hi TenTenths, yup it works..
actually, i tried this command: grep -E "asz.*07/Feb/2014" list.log it still includes other years.. so when using the grep if the text to be search is on the left the pattern should be on the left also.. hmmm... :) but when I reversed it as what you suggested it works.. For other people who might bump to this post.. the grep search for two patterns with an AND expression here's the command, courtesy of TenTenths Quote:
---------- Post added 02-07-14 at 04:57 AM ---------- Simple way and works..is what matter most... hehehe... Thanks TenTenths.. ;) |
All times are GMT -5. The time now is 10:20 AM. |