[plug] Grep not following my regex

Ritchie Young ritchiey at gmail.com
Tue Sep 15 12:39:15 WST 2009


>
> Do grep \. testfile
>
> and it will match every char in the file.  The '.' isn't escaped by the
> '\'.
>

Wouldn't that be because it's escaping the '.' for the shell but not grep?

So 'grep \\. /etc/passwd' will output only the lines that contain a '.'

Using [.] does indeed treat it as a literal.


Yes, '.' inside square brackets isn't a wildcard.

To keep it simple, why not surround your entire regex with single-quotes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20090915/2e104871/attachment.html>


More information about the plug mailing list