[plug] Grep not following my regex
Tim Bowden
tim.bowden at westnet.com.au
Tue Sep 15 12:52:01 WST 2009
On Tue, 2009-09-15 at 12:39 +0800, Ritchie Young wrote:
>
>
> 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.
Yes, you're right. My snafu.
Tim Bowden
More information about the plug
mailing list