[plug] Grep not following my regex

Tim Bowden tim.bowden at westnet.com.au
Tue Sep 15 12:19:04 WST 2009


On Tue, 2009-09-15 at 12:15 +0800, Mark O'Shea wrote:
> On Tue, Sep 15, 2009 at 11:49:20AM +0800, Tim Bowden wrote:
> > Do grep \. testfile
> > 
> > and it will match every char in the file.  The '.' isn't escaped by the
> > '\'.  Using [.] does indeed treat it as a literal.  In any event, there
> > is a problem if there is more than one number in any input line.
> > 
> for: grep \. testfile
> . is espaped by the shell and passed on to grep, which then interprets
> it.
> for: grep "\." testfile
> \. is passed to grep and grep escapes the . to match a literal .
> 
> This stuff isn't hard if you keep in mind what the shell is and what it
> does.  I think the OP got that part but was confused elsewhere.
> 
*smacks self on forehead*

Of course.




More information about the plug mailing list