View Issue Details

IDProjectCategoryView StatusLast Update
00007791003.1(2008)/Issue 7Shell and Utilitiespublic2024-06-11 08:52
Reporterdwheeler Assigned Toajosey  
PrioritynormalSeverityObjectionTypeEnhancement Request
Status ClosedResolutionAccepted As Marked 
NameDavid A Wheeler
Organization
User Reference
Sectionsed
Page Number3184
Line Number106510
Interp Status---
Final Accepted TextSee 0000779:0002050
Summary0000779: Add "ignore case" flag to sed's "s": s/old/new/I
DescriptionCurrently the POSIX standard provides no "ignore case" flag for sed's substitute (s) command. Yet case-insensitive matching is useful. The regcomp() function already supports this via the flag REG_ICASE (see POSIX 2013, page 1783). As noted in one sed FAQ (http://sed.sourceforge.net/sedfaq4.html#s4.10), without this capability "case-insensitive searching is awkward".

GNU sed, FreeBSD sed, and Busybox sed all support case-insensitive matching using the "I" (capital I) flag:
* https://www.gnu.org/software/sed/manual/sed.html#The-_0022s_0022-Command
* http://www.freebsd.org/cgi/man.cgi?query=sed&apropos=0&sektion=0&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html
* http://git.busybox.net/busybox/tree/editors/sed.c?h=1_21_stable (line 421)

FreeBSD and busybox only support "I" as the flag, not "i". GNU sed actually supports both "i" and "I". However, since FreeBSD only supports "I", I propose that one. Note that one sed tutorial (http://www.grymoire.com/Unix/Sed.html#uh-38) only notes "I" with GNU sed, so that seems to be the more popular choice. Note, however, that perl uses "i" not "I" - so there is some argument for "i". If people want to use "i" as the flag instead of "I" that's fine with me. We just need to pick a flag so sed scripts can port.
Desired ActionAfter line 106510, add:

I Match the regular expression in a case-insensitive way.

Tagsissue8

Activities

nick

2013-12-05 17:30

manager   bugnote:0002050

Last edited: 2013-12-05 17:31

After line 106510, add:

i Match the regular expression in a case-insensitive way.

Add new para to APPLICATION USAGE after line 106550:
Note that some implementations of sed also support an 'I' flag for the 's' command as an alias for the lower case 'i' flag.

Issue History

Date Modified Username Field Change
2013-10-28 22:00 dwheeler New Issue
2013-10-28 22:00 dwheeler Status New => Under Review
2013-10-28 22:00 dwheeler Assigned To => ajosey
2013-10-28 22:00 dwheeler Name => Your Name Here
2013-10-28 22:00 dwheeler Section => sed
2013-10-28 22:00 dwheeler Page Number => 3184
2013-10-28 22:00 dwheeler Line Number => 106510
2013-12-05 17:24 nick Tag Attached: issue8
2013-12-05 17:30 nick Interp Status => ---
2013-12-05 17:30 nick Note Added: 0002050
2013-12-05 17:30 nick Resolution Open => Accepted As Marked
2013-12-05 17:31 nick Name Your Name Here => David A Wheeler
2013-12-05 17:31 nick Final Accepted Text => See 0000779:0002050
2013-12-05 17:31 nick Status Under Review => Resolved
2013-12-05 17:31 nick Note Edited: 0002050
2013-12-05 17:31 nick Note Edited: 0002050
2020-03-25 15:53 geoffclare Status Resolved => Applied
2024-06-11 08:52 agadmin Status Applied => Closed