1

I want to find, in all the files in a directory, the pattern

t00 = 290
or
t00     = 300
or
t00 =    -278
...

in other words: (string "t00") + (1 or more white spaces) + (symbol "=") + (1 or more white spaces) + (perhaps a negative sign) + (number)

I have tried

grep -E "t00 += +-?\d" *

but it is not working as desired. Just trying I did

grep -P "t00 += +-?\d" *

and it works for Perl expressions. What am I do wrong in the case of extended regular expressions? I would like to use extended regular expressions instead of Perl because I have heard it is more common/universal (I may be wrong in this, though). Thx.

David
  • 113

1 Answers1

4

The problem is the \d statement which is not part of the extended regular expression standard. You could try the [[:digit:]] POSIX character class (or [0-9] on implementations that don't understand those) instead.

AdminBee
  • 22,803