Using Regular Expressions to Filter Your Server’s Logs

Toby Fee on August 09, 2019

Did you enjoy my introduction to Regular Expressions (RegEx)? Let’s use some to do some actual work. Here’s a classic problem You run a... [Read Full]
markdown guide
 

quick question, which grep allows you to use \d? as far as I know, only GNU grep with -P option (PCRE) will allow it, otherwise you have to use [0-9] or the POSIX character set [:digit:] inside a character class

also, ERE is enabled using -E not -e, from GNU grep's man page:

   -e PATTERNS, --regexp=PATTERNS
          Use  PATTERNS  as  the  patterns.   If  this  option  is used multiple times or is combined with the -f
          (--file) option, search for all patterns given.  This option can be used to protect a pattern beginning
          with “-”.

   -E, --extended-regexp
          Interpret PATTERNS as extended regular expressions (EREs, see below).
 
 

this is a lot neater than my thing, I'll have to try to run it some time! Thanks for sharing!

code of conduct - report abuse