[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19240: cut 8.22 adds newline
From: |
Paul Eggert |
Subject: |
bug#19240: cut 8.22 adds newline |
Date: |
Mon, 01 Dec 2014 14:24:55 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
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.
- bug#19240: cut 8.22 adds newline, John Kendall, 2014/12/01
- bug#19240: cut 8.22 adds newline, Eric Blake, 2014/12/01
- Message not available
- bug#19240: cut 8.22 adds newline, Eric Blake, 2014/12/01
- bug#19240: cut 8.22 adds newline, Pádraig Brady, 2014/12/01
- bug#19240: cut 8.22 adds newline,
Paul Eggert <=
- bug#19240: cut 8.22 adds newline, Eric Blake, 2014/12/01
- bug#19240: cut 8.22 adds newline, Pádraig Brady, 2014/12/01
- bug#19240: cut 8.22 adds newline, Bob Proulx, 2014/12/04
- bug#19240: cut 8.22 adds newline, John Kendall, 2014/12/04
- bug#19240: cut 8.22 adds newline, Paul Eggert, 2014/12/04
- bug#19240: cut 8.22 adds newline, John Kendall, 2014/12/04
- bug#19240: cut 8.22 adds newline, Eric Blake, 2014/12/04
- bug#19240: cut 8.22 adds newline, Eric Blake, 2014/12/04
- bug#19240: cut 8.22 adds newline, John Kendall, 2014/12/04
- bug#19240: cut 8.22 adds newline, Bob Proulx, 2014/12/04