I need some help from the wise-guys of Arizona.

kitepilot at kitepilot.com kitepilot at kitepilot.com
Sat Mar 7 10:31:01 MST 2015


No Michael, you don 'get it' yet.
And you won't for a while. 

In the context of what you are talking, '^', '$' and '*' are components of a 
'regular expression' 

A 'regular expression' is a language that allows you to describe strings and 
it can be *VERY* complex.
http://en.wikipedia.org/wiki/Regular_expression
ET 

 

Michael Havens writes: 

> oh. so '*' searches the first string in the  lines.... I understand that
> now.
> and $ matches the end string of lines. I get it now! 
> 
> :-)~MIKE~(-: 
> 
> On Sat, Mar 7, 2015 at 8:43 AM, sean <sean.a.ritzler at gmail.com> wrote: 
> 
>> $ 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. 
>>
>> 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: 
>>
>> My name is bmike1
>> bmike1 is my name 
>>
>> Then do grep ^bmike1, grep bmike1 and just grep bmike1 (no -E necessary).
>> On Mar 7, 2015 8:34 AM, "Michael Havens" <bmike1 at gmail.com> wrote: 
>>
>>> 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 at c521 ~ $ grep -E '^bmike1:' /etc/passwd
>>> bmike1:x:1000:1000:Michael Havens,,,:/home/bmike1:/bin/bash
>>> bmike1 at c521 ~ $ grep -E 'bmike1:' /etc/passwd
>>> bmike1:x:1000:1000:Michael Havens,,,:/home/bmike1:/bin/bash
>>> bmike1 at c521 ~ $ grep -E 'bmike1$:' /etc/passwd
>>> bmike1 at c521 ~ $ grep -E 'bmike1$' /etc/passwd
>>> bmike1 at c521 ~ $ 
>>>
>>>
>>> :-)~MIKE~(-: 
>>>
>>> On Fri, Mar 6, 2015 at 11:39 PM, der.hans <PLUGd at 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 at 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 at 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 at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss 
>>


More information about the PLUG-discuss mailing list