-1

I am attempting to search for 3.07 in a log file however I'm having difficulty with the correct regex. I have tried the following but this returns values matching 3.0 or 3.7:

grep '[3]\.[07]' GDCBAdapter.log
EamonnMcElroy
  • 587
  • 6
  • 20

3 Answers3

2

The solution is very simple, you just have to:

grep '3\.07' GDCBAdapter.log

No need for character class, i.e [07] as it matches 0 OR 7.

Maroun
  • 94,125
  • 30
  • 188
  • 241
2

No regex is required at all. You can simply search for fixed strings using -F:

grep -F '3.07' GDBCAdapter.log

man grep

hek2mgl
  • 152,036
  • 28
  • 249
  • 266
-2

Just realised:

grep '[3]\.\08' GDCBAdapter.log
EamonnMcElroy
  • 587
  • 6
  • 20