I have a file named newfile
. The contents of this file are:
abc
xyz
abc
Now I want to find lines which start with a
and end with c
. I enter the following command but the results are not the same as expected by me:
grep -E '^ac$' newfile
The problem with this command is that when I use ^ac$
the command interprets it as starting with ac
instead of starting with a
.