The following issue has been SUBMITTED. ====================================================================== https://www.austingroupbugs.net/view.php?id=1556 ====================================================================== Reported By: calestyo Assigned To: ====================================================================== Project: Issue 8 drafts Issue ID: 1556 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: New Name: Christoph Anton Mitterer Organization: User Reference: Section: Utilities, sed / 9.3.5 RE Bracket Expression Page Number: - Line Number: - Final Accepted Text: ====================================================================== Date Submitted: 2022-01-18 01:07 UTC Last Modified: 2022-01-18 01:07 UTC ====================================================================== Summary: clarify meaning of \n used in a bracket expression in a sed context address or s-command Description: The description of RE Bracket Expressions themselves says: »When the bracket expression appears within a BRE, the special characters '.', '*', '[', and '\\' (<period>, <asterisk>, <left-square-bracket>, and <backslash>, respectively) shall lose their special meaning within the bracket expression. When the bracket expression appears within an ERE, the special characters '.', '(', '*', '+', '?', '{', '|', '$', '[', and '\\' (<period>, <left-parenthesis>, <asterisk>, <plus-sign>, <question-mark>, <left-brace>, <vertical-line>, <dollar-sign>, <left-square-bracket>, and <backslash>, respectively) shall lose their special meaning within the bracket expression; <circumflex> ('^') shall lose its special meaning as an anchor.« (line 5840, draft)
OTOH, "Regular Expressions in sed" says: »The escape sequence '\n' shall match a <newline> embedded in the pattern space. A literal <newline> shall not be used in the RE of a context address or in the substitute function.« (line 106092, draft) There is no mentioning which of the two wins, i.e. whether [\n] in a sed context address or s-command would be the bracket expression of a single newline, or that of a '\' and a 'n'. GNU sed for example seems to consider it a newline. This is somewhat related to Issue 0001551, which also deals with similar ambiguities with respect to how REs are parsed in sed. Desired Action: Clarify at least in the sed section (or ideally in both places) how '\n' in a bracket expression is to be interpreted. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2022-01-18 01:07 calestyo New Issue 2022-01-18 01:07 calestyo Name => Christoph Anton Mitterer 2022-01-18 01:07 calestyo Section => Utilities, sed / 9.3.5 RE Bracket Expression 2022-01-18 01:07 calestyo Page Number => - 2022-01-18 01:07 calestyo Line Number => - ======================================================================
