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?
bmike1@c521 ~ $ grep -E '^bmike1:' /etc/passwd
bmike1:x:1000:1000:Michael Havens,,,:/home/bmike1:/bin/bash
bmike1@c521 ~ $ grep -E 'bmike1:' /etc/passwd
bmike1:x:1000:1000:Michael Havens,,,:/home/bmike1:/bin/bash
bmike1@c521 ~ $ grep -E 'bmike1$:' /etc/passwd
bmike1@c521 ~ $ grep -E 'bmike1$' /etc/passwd
bmike1@c521 ~ $
:-)~MIKE~(-:
On Fri, Mar 6, 2015 at 11:39 PM, der.hans <
PLUGd@lufthans.com> wrote:
> Am 06. Mär, 2015 schwätzte Michael Havens so:
>
> moin moin Mike,
>
> when using regular expressions '$' matches the end of the line and '^'
> matcheѕ the beginning of the line. So, '^$' matches a blank line.
>
> grep -E '^fred:' /etc/passwd # shows the entry for fred's account
>
> grep -E ':/bin/bash$' /etc/passwd # shows all of the accounts that have
> bash as their shell
>
> ciao,
>
> der.hans
>
>
> I'm going through the BASH manual at The Linux Documentation Project and
>> was going over special characters. They say that 'a "$" addresses the end
>> of a line bash'. Huh; what does that mean? You see on my blog that I had
>> another special character I was wondering about but my web search revealed
>> to me what was hidden. My web search in this case turns up a lot of stuff
>> too. None of it relevant though. Could you wonderful people of Plug remove
>> the scales from my eyes?
>> :-)~MIKE~(-:
>>
>>
> --
> # http://www.LuftHans.com/ http://www.PhxLinux.org/
> # "Metrosexuals notwithstanding, quiche still lacks something." -- David
> Brin
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss