a simple question about grep
Ben Scott
dragonhawk at gmail.com
Fri Sep 7 10:57:34 EDT 2007
On 9/7/07, Tom Buskey <tom at buskey.name> wrote:
>> egrep -P "^\*(?!INDICATOR)" filename.txt
>
> GNU egrep 2.5.1 doesn't work:
> $ egrep '^\*(?!INDICATOR)' z
> $
You need to specify -P (or --perl) to turn on support for Perl
regular expression extensions. Otherwise it will interpret the "(?"
as... hmmm, to tell the truth, I'm not sure what that'll do. I don't
think that's valid traditional regexp syntax. In any event, it won't
work.
Hmmm, for that matter, it doesn't seem to like "egrep -P". I guess
that's because "egrep" is basically just the same thing as "grep -E",
and "grep -E -P" is invalid. So try "grep -P". On a CentOS 5.0 box:
$ grep '^\*(?!INDICATOR)' sample
$ grep -P '^\*(?!INDICATOR)' sample
*geoid gender location
*district court
$ rpm -q grep
grep-2.5.1-54.2.el5
$
-- Ben
More information about the gnhlug-discuss
mailing list