I am trying to find out if any of the floats in the first column containing floats in a CSV have a 1 after the decimal point. Here is an example row from my CSV:
1082805252197942751,34225793738713276,serialtooldata,1,Goals,75512140,125.0,63.0,29.0,1,,,,0,899,,
The seventh column is the one I am interested in, and in the row above it does not have a 1 after the decimal point (125.0)
I've come up with two potential regular expressions:
^[0-9]+,[0-9]+,[a-z0-9]+,[0-9]+,[A-Za-z0-9\ ]+,[0-9]+,[0-9]+\.1
or
^[A-Za-z0-9\ ,]+\.1
These both seem to work, i.e. on a regex test page (like regex101 here and here) the line correctly fails to match either regex. But when I try them at the terminal like this
egrep ^[0-9]+,[0-9]+,[a-z0-9]+,[0-9]+,[A-Za-z0-9\ ]+,[0-9]+,[0-9]+\.1 tool_data_160321.csv
or
egrep ^[A-Za-z0-9\ ,]+\.1 tool_data_160321.csv
then the line is listed as a match. Why does egrep
think the line matches either regex when it doesn't?
-o
flag.