Bug 271791 - sed: substitute start/end of line broken with N
Summary: sed: substitute start/end of line broken with N
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-02 20:51 UTC by Mohamed Akram
Modified: 2023-11-03 11:38 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mohamed Akram 2023-06-02 20:51:12 UTC
To reproduce:

printf '%s\n' hello '' world | sed -n -e 's/^//' -e '$!N' -e P -e D

Expected output:

hello

world

Actual output:

hello
h
world
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2023-06-02 21:31:36 UTC
This is reproducible on -current.

The output of GNU sed:

$ printf '%s\n' hello '' world | gsed -n -e 's/^//' -e '$!N' -e P -e D
hello

world