I need to find and display lines in the shell using egrep that start with r and end with g.
I have
egrep -e "^r*g$" testfile.txt
but it is not giving me any results, what am I doing wrong?
adding a .
should work
egrep -e "^r.*g$"
It basically means : everything that starts with a r, then is followed by zero or more anything, and then ends with g.
tested against
r fsgdfs gfsdg
fooo bar
rfoo g
fdsqfdsq
rg
it returns
r fsgdfs gfsdg
rfoo g
rg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With