<p dir="ltr">$ matches the end of line. You don't get any output because that file doesn't have any lines ending in 'bmike1'. That's why it was recommended that you grep for a shell.</p>
<p dir="ltr">You are getting the same output with and without the ^ because it happens to be that bmike1 always appears at the beginning of the line in that file. Create a new file with these two lines:</p>
<p dir="ltr">My name is bmike1<br>
bmike1 is my name</p>
<p dir="ltr">Then do grep ^bmike1, grep bmike1 and just grep bmike1 (no -E necessary).</p>
<div class="gmail_quote">On Mar 7, 2015 8:34 AM, "Michael Havens" <<a href="mailto:bmike1@gmail.com">bmike1@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Okay, I tried to grep my passwd file with and without the '^' and it seems both are the same. What's the difference between the commands and why should I bother to type the '^'? As to the '$' if all it does is produces a blank linr what is it's use?</div><div><br></div><div>bmike1@c521 ~ $ grep -E '^bmike1:' /etc/passwd</div><div>bmike1:x:1000:1000:Michael Havens,,,:/home/bmike1:/bin/bash</div><div>bmike1@c521 ~ $ grep -E 'bmike1:' /etc/passwd</div><div>bmike1:x:1000:1000:Michael Havens,,,:/home/bmike1:/bin/bash</div><div>bmike1@c521 ~ $ grep -E 'bmike1$:' /etc/passwd</div><div>bmike1@c521 ~ $ grep -E 'bmike1$' /etc/passwd</div><div>bmike1@c521 ~ $ </div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div>:-)~MIKE~(-:</div></div>
<br><div class="gmail_quote">On Fri, Mar 6, 2015 at 11:39 PM, der.hans <span dir="ltr"><<a href="mailto:PLUGd@lufthans.com" target="_blank">PLUGd@lufthans.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 06. Mär, 2015 schwätzte Michael Havens so:<br>
<br>
moin moin Mike,<br>
<br>
when using regular expressions '$' matches the end of the line and '^'<br>
matcheѕ the beginning of the line. So, '^$' matches a blank line.<br>
<br>
grep -E '^fred:' /etc/passwd # shows the entry for fred's account<br>
<br>
grep -E ':/bin/bash$' /etc/passwd # shows all of the accounts that have<br>
bash as their shell<br>
<br>
ciao,<br>
<br>
der.hans<div><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm going through the BASH manual at The Linux Documentation Project and<br>
was going over special characters. They say that 'a "$" addresses the end<br>
of a line bash'. Huh; what does that mean? You see on my blog that I had<br>
another special character I was wondering about but my web search revealed<br>
to me what was hidden. My web search in this case turns up a lot of stuff<br>
too. None of it relevant though. Could you wonderful people of Plug remove<br>
the scales from my eyes?<br>
:-)~MIKE~(-:<br>
<br>
</blockquote>
<br></div></div><span><font color="#888888">
-- <br>
# <a href="http://www.LuftHans.com/" target="_blank">http://www.LuftHans.com/</a> <a href="http://www.PhxLinux.org/" target="_blank">http://www.PhxLinux.org/</a><br>
# "Metrosexuals notwithstanding, quiche still lacks something." -- David Brin</font></span><br>---------------------------------------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.phxlinux.org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br></blockquote></div><br></div>
<br>---------------------------------------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org">PLUG-discuss@lists.phxlinux.org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br></blockquote></div>