bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep


From: Stephane Chazelas
Subject: Re: grep
Date: Thu, 26 Apr 2007 07:37:49 +0100
User-agent: Mutt/1.5.6i

On Wed, Apr 25, 2007 at 11:41:23PM +0200, Bauke Jan Douma wrote:
> Vladislav Gula wrote on 25-04-07 19:33:
> >
> >echo "alias: something" | grep '^[[:alnum:]]:' - not work.
> >
> >
> >why ?
> >
> >Regards,
> >Vladislav
> >
> >
> >P.S.
> >echo "alias: something" | grep '^[[:alnum:]]:.*$' - not work too.
> >( and various variations )
> 
> Make it:
> echo "alias: something" | grep '^[[:alnum:]]*:'
> or:
> echo "alias: something" | grep '^[[:alnum:]]\+:'
[...]

It should be noted that \+ is GNU specific, it's a non-standard
hybrid between the basic and extended regexp.

There's not much point using it with grep given that grep has
the standard -E option to use extended regexp:

grep -E '^[[:alnum:]]+:'

The standard BRE equivalent is:

grep '^[[:alnum:]]\{1,\}:'

-- 
Stéphane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]