[plug] Grep not following my regex

Mark O'Shea mark at musicalstoat.co.uk
Tue Sep 15 12:15:15 WST 2009


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.

-- 
Mark



More information about the plug mailing list