Fw: Unix question

Jay R. Ashworth jra at baylink.com
Fri Apr 16 11:49:47 PDT 2004


On Fri, Apr 16, 2004 at 01:30:14PM -0400, Brian K. White wrote:
> >> You said that the backslashes were "to tell grep that the ( and ) are
> >> part of the string being searched".  With the command you wrote, grep
> >> will never see the backslashes, as they will be eaten by the shell.
> >> If your intention were to pass backslashes to grep, you would have
> >> had to double the backslashes.  As written, it is the shell that you
> >> are telling to pass the parens to grep, rather than having the shell
> >> give them special meaning.  (Or, just put it in quotes, and leave the
> >> backslashes off.)
> > 
> > [this turned into a mini-lecture, and I happen to be replying to a
> > post by ken, but I know ken is already familiar with all this so
> > please don't think i'm insulting you ken]
> > 
> > But, perens have no special meaning to grep the way they do the
> > shell, so, they only need to be escaped once for the command to do
> > what he expected/wanted, which it did.

I believe that that depends on the grep; egrep support 'alternation'
of regex segments (ie: OR), and it uses parens to group these.

Cheers,
-- jra
-- 
Jay R. Ashworth                                                jra at baylink.com
Member of the Technical Staff     Baylink                             RFC 2100
The Suncoast Freenet         The Things I Think
Tampa Bay, Florida        http://baylink.pitas.com             +1 727 647 1274

        "They had engineers in my day, too."  -- Perry Vance Nelson


More information about the Filepro-list mailing list