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
>Organization:
>Environment:
NetBSD kitsune.snert.com 6.1.5 NetBSD 6.1.5 (GENERIC) amd64

>Description:
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/./&\
/g'
1
2
3
$

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'
1
2
3
$

Which is cleaner representation.
>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index