NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/50111: sed does not support \n newline in replacement patterns.

>Number:         50111
>Category:       bin
>Synopsis:       sed does not support \n newline in replacement patterns.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 01 12:25:00 +0000 2015
>Originator:     Anthony Howe
>Release:        6.1.5
NetBSD 6.1.5 NetBSD 6.1.5 (GENERIC) amd64

Historically, sed did not support "\n" sequences in the substitution replacement string.  However, newer implementations, like GNU sed, do.
It would be useful for clarity and legibility of shell scripts to support "\n" in the replacement string.

So for example the current manner of splitting text with a newline is:

$ printf '123' | sed -e 's/./&\

When the above is used a shell script, any line/block indention would be disrupted, because of requiring a backslash and literal newline.

The proposed enhancement would allow:

$ printf '123' | sed -e 's/./&\n/g'

Which is cleaner representation.


Home | Main Index | Thread Index | Old Index