[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep --perl-regexp and empty match
From: |
Jori Mantysalo |
Subject: |
Re: grep --perl-regexp and empty match |
Date: |
Thu, 3 Jul 2003 22:11:38 +0300 (EEST) |
On Thu, 3 Jul 2003, Paul Jarc wrote:
>> I was trying to get "one" and "two" from string "<B>one</B> and
>> <B>two</B>".
> I'd use sed for that, not grep.
Yes, I now; and perl would work too. I was just testing grep, and
searching limits for what-you-can-do-with-grep -question.
>> grep -o -P '<B>.*?</B>'
> $ echo "<B>one</B> and <B>two</B>" | grep -o -P '<B>.*?</B>'
> grep: The -P option is not supported
> $ grep --version|sed q
> grep (GNU grep) 2.5.1
> Are you sure you're using GNU grep?
address@hidden jm58660]$ grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
If I remember correctly, there was some compile-time setting that
will make perl-style regexps available. I am using Red Hat Linux, maybe
default grep installed with other distributions has compiled differently?
--
Jori Mäntysalo