GNU bug report logs -
#19240
cut 8.22 adds newline
Previous Next
Reported by: John Kendall <john <at> capps.com>
Date: Mon, 1 Dec 2014 16:44:01 UTC
Severity: normal
Tags: notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 12/01/2014 02:06 PM, Pádraig Brady wrote:
> If we were just implementing now, I'd not output the extra '\n',
I have just the opposite kneejerk reaction; typically text-based apps
are simpler and easier to document and use when they silently pretend
that the input had a trailing newline. That's what 'awk' and 'grep' do,
for example, and they works fine. There are some solid counterexamples
(e.g., Emacs, diff) but they have good reasons to be counterexamples.
> a newline should only be added where needed,
> especially with a low level tool like sed.
I'm afraid 'sed' is not that low-level, and GNU sed's current behavior
is inconsistent. Sometimes it silently appends a trailing newline to
the input before processing it, and sometimes it doesn't:
$ printf x | sed '$a\
> y'
x
y
$ printf x | sed 's/$/y/'
xy$
> changing at this stage needs to be carefully considered
Yes, the use cases are key here.
This bug report was last modified 10 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.