Go Go Gnome
the website of Sander Kooijmans

Plus sign does not work in grep

Posted: April 27, 2012

In a bash shell under cygwin I used grep like this:

grep [0-9]+[.][0-9]+ <filename>

I expected a line like "...>2.49<..." to match. Unfortunately, this was not the case. It turns out that the plus sign is part of the extended regular expression syntax.

To let grep use the extended regular expression syntax, use this:

grep -E [0-9]+[.][0-9]+ <filename>