What's going wrong in below grep expression, appreciate any help.
$cat foo.txt
## not to be read
; this one too and next one also coz it has sapce
first_var= first_val
second_var=y
second_var=yes
Now when I run below grep on Mac/Linux
grep "^[^#;].*[^[:space:]]\=[^[:space:]].*[^=]" foo.txt
I get below output
second_var=yes
whereas I was expecting
second_var=y
second_var=yes
what I am going wrong here?
In the part after the
=you expect 2 characters, and you only have a singleyYou could make the second part optional if it should end on any character except
=Output