-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
  • 557
  • 6
  • 18

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
  • 91,013
  • 29
  • 181
  • 233
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
  • 143,113
  • 25
  • 227
  • 253
-2

Just realised:

grep '[3]\.\08' GDCBAdapter.log
EamonnMcElroy
  • 557
  • 6
  • 18