Harsh J | Memoirs of a QWERTY Keyboard

GNU egrep does not support the \d shorthand

I learnt this the hard way (and said hello to a large living world of non-standard regex implementations). The GNU grep/egrep documentation page documents all their special backslash character support but \d is not one of them.

That is, the following will not work when trying to match a numeric digit at the beginning of file (for example):

egrep '^\d' file.log

You need to use either of these two alternative forms instead:

egrep '^[:digit:]' file.log (OR) egrep '^[0-9]' file.log