I need to find and display the lines in the shell using egrep that start with r and end with g.
I have
egrep -e "^r*g$" testfile.txt
but it does not give me any results, what am I doing wrong?
Appendix a . should work
.
egrep -e "^r.*g$"
This basically means: everything that starts with r, then is followed by zero or more than anything, and then ends with the letter g.
checked for
r fsgdfs gfsdg fooo bar rfoo g fdsqfdsq rg
he returns
r fsgdfs gfsdg rfoo g rg
* matches r , not "nothing in between." Update it to .* And you will see the results:
*
r
.*
egrep -e "^r.*g$" testfile.txt