<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 class="gmail_signature">:-)~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 class="HOEnZb"><div class="h5"><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 class="HOEnZb"><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">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>