File has ASCII data followed by binary data.
ASCII data contains lines. Binary data contains 0's and follows.
I use sed(1) to delete lines and present me the rest of the content in
untouched form. In other words: I want to get binary data streamed
throught sed(1) without modification.
Currently sed(1) appends '\n' at the end of such data.
gsed(1) works as expected.
While gsed(1) just pipes binary data without a problem, we
pipe data, but append '\n' at the end.
How-To-Repeat: Install ports/textproc/gsed for comparison.
echo 1 > data
echo 2 >> data
echo 3 >> data
dd if=/dev/zero bs=1m count=1 >> data
echo "========== WE ========="
cat data | sed '1,3 d' | hexdump -c | tail -5
echo "========== GNU ========"
cat data | gsed '1,3 d' | hexdump -c | tail -5
A commit references this bug:
Date: Fri Aug 8 17:29:02 UTC 2014
New revision: 269729
sed(1): Don't force a newline on last line, if input stream doesn't have one
While here, change how we check if the current line is the last one.
Before, we just checked if there were more files after the current one.
Now, we check the actual content of those files: they files may not have
a line at all. This matches the definition of the "last line" by the
The new behavior is closer to GNU sed.
Reviewed by: jilles
Approved by: jilles
Exp-run by: antoine
Committed in 11-CURRENT.