Re: How to grep xxx or yyyy



dingdongdingding@xxxxxxxxx wrote:
Hi !
I need to search the logs for events matching a condition that
occurred today or yesterday. I know how to do a AND but how to do a OR
?

AND
grep "event" | grep today_date

OR
grep "event" | grep today_date OR yesterday_date.......... how ???

With grep, you can't really. Use egrep instead, and you can separate test
strings with |.

I have forced my fingers to learn 'egrep' in place of 'grep' since it is
100% compatabile with grep (as far as I've ever seen), and also ubiquitous.

Colin
.



Relevant Pages

  • Re: Fraudulent eBay listing
    ... O.K. I had not noticed that you were using plain grep, ... in egrep), * simply stands for "zero or more of the preceding ... Interpret PATTERN as an extended regular expression. ...
    (rec.crafts.metalworking)
  • Re: Python MAPI
    ... registry edits, so I disabled my filters and ran it without. ... egrep - which is a more powerful version of grep; ... "pattrn" which looks in parallel for pattern1, patturn1, ...
    (comp.lang.python)
  • Re: egrep question
    ... The trick to using grep and egrep effectively is to truly understand how pattern ... Tale of Two Cities ... The book titles have spaces, periods, etc. ...
    (AIX-L)
  • Re: regex back matching
    ... for matching IP addresses... ... egrep is a version of the Unix grep program that does regular ... two variant programs egrep and fgrep are available. ...
    (comp.lang.perl.misc)
  • Re: Match the full stop and quotation mark literally with regexp by using egrep.
    ... U+0022 literally with regexp by using egrep. ... egrep is long obsolete; use grep -E. ... The quotation mark isn't special in regexps, ... If your regex pattern doesn't contain a single quote, ...
    (comp.unix.shell)