Re: files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2006-11-30 at 02:22 +1030, Tim wrote:
> Jacques B.:
> >> grep -ir "^put sentence here$" *
> 
> Ingemar Nilsson:
> > Note that this will only match if the sentence is on a line by itself,
> > since ^ and $ means beginning of line and end of line respectively.
> 
> Are you sure about that?  I thought they just meant that the string
> begins with, and ends with, the enclosed characters.  I didn't think
> they actually refered to end-of-line indicators, the same markers are
> used in wildcarding where there isn't a notion of "lines" (e.g. URIs).
> 
Using a URI is not the same as having the bash shell interpret the
command line.
In bash (and regexes) in the format used above the ^ literally means
"line begins with" and the $ means "line ends with"

To have it match anywhere in the line you must remove those special
characters.

Try it yourself if you need proof.
 
> -- 
> (Currently testing FC5, but still running FC4, if that's important.)
> 
> Don't send private replies to my address, the mailbox is ignored.
> I read messages from the public lists.
> 


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux