[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed: Case-insensitive matching does not work
From: |
Stepan Kasal |
Subject: |
Re: sed: Case-insensitive matching does not work |
Date: |
Wed, 9 Oct 2002 16:40:05 +0200 |
User-agent: |
Mutt/1.2.5.1i |
Hello,
On Wed, Oct 09, 2002 at 01:59:17PM +0200, Francesco Potorti` wrote:
> Package: sed
> Version: 3.02-8
> Severity: normal
I'd say it's NOT A BUG, just a dark corner of sed:
> bash-2.05b$ sed -e '/href=raw/s//href=pot/I'
> href=raw --> href=pot
> HREF=RAW --> HREF=RAW
A few examples:
/foo/Id deletes lines containning the regex, case insensitive;
s/foo/bar/I replacement---``foo'' is interpreted case insensitive;
/xxx/Is/foo/bar/ replacement which is performed on each line matching
the /xxx/ interpreted case insesitively; the /foo/
is interpreted case sensitively.
/xxx/s/foo/bar/I replacement is performed on lines matching /xxx/ (case
sensitive), the replacement itself is case insensitive.
So there are two places where ``I'' may (or may not) be.
These two bits of information are independent, even when you use the
shortcut
/foo/s//bar/
So, the thing you mean may be written in any of the following ways:
/href=raw/Is/href=raw/href=pot/I
/href=raw/Is//href=pot/I
or even:
s/href=raw/href=pot/I
I consider the last form as the most readable one.
Is there any special reason why it cannot be used?
HTH,
Stepan Kasal