hofbrau hofbrau - 3 months ago 14
Linux Question

grep “+” operator does not work

File content (text.txt)

test aNd###liKe test

Example 1, working

grep -i "and...like" test.txt

Example 2, not working

grep -i "and.+like" test.txt

just needs at least one match or more, but why is example 2 not working?


You need to escape the + sign:

grep -i "and.\+like" test.txt

The unescaped dot . already matches every character