I have some log files that I'm grepping through which contain entries in the following form
foo($abc) - sometext
foo ($xyz) - moretext
baz($qux) - moartext
I'm looking to use grep that would output the first two lines as matches, i.e.
foo($abc)
foo ($xyz)
I've tried the following grep statement
grep 'foo(\$' log.txt
which outputs the first match, but I tried to include an optional space, and neither return:
grep 'foo\s?(\$' log.txt
I'm using the optional space incorrectly, but I'm unsure how