Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2013 18:38:30 GMT
From:      "David A. Wheeler" <dwheeler@dwheeler.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   standards/184641: Please add "i" flag to sed substitute ("s") command
Message-ID:  <201312091838.rB9IcUiA094158@oldred.freebsd.org>
Resent-Message-ID: <201312091840.rB9Ie0Xl076760@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         184641
>Category:       standards
>Synopsis:       Please add "i" flag to sed substitute ("s") command
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 09 18:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     David A. Wheeler
>Release:        N/A
>Organization:
>Environment:
N/A
>Description:
Please add support for an "i" flag in sed's "s////" command to do case-insensitive matching, as a synonym for the current "I" flag.

Case-insensitive matching is useful, but historically it hasn't been in POSIX. The POSIX folks have just accepted a proposal to add the "i" flag to do this. FreeBSD can already has this functionality, but it uses "I" not "i". By adding "i" as a synonym for "I", FreeBSD's sed would support the capability, and make it easier to port other code to FreeBSD. The POSIX decision is documented here:
    http://austingroupbugs.net/view.php?id=779

Thanks!

>How-To-Repeat:
sed -e 's/hi/hello/i' <<TEXT
hi
TEXT


>Fix:
I think this is trivial.  This can probably be fixed by modifying sed's "compile.c" file, function compile_flags(), around line 585. Currently this is:
 	case 'I':
 	s->icase = 1;

I think you can just prepend this line:
        case 'i':



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312091838.rB9IcUiA094158>