standards/184641: Please add "i" flag to sed substitute ("s") command
David A. Wheeler
dwheeler at dwheeler.com
Mon Dec 9 18:40:01 UTC 2013
>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:
More information about the freebsd-standards
mailing list