diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-05-30 17:44:32 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-06-01 12:14:39 +0100 |
commit | 5c6cf94ba5f6c05b3ab6e732de7202754558c03c (patch) | |
tree | c042e76c151a9ee32b26ae88ce68637bb48c9c03 /COPYING | |
parent | 39d1c9576a3f2e5e65c5fb06744aa7245d743bc0 (diff) | |
download | coreutils-5c6cf94ba5f6c05b3ab6e732de7202754558c03c.tar.xz |
cut: restore special case handling of -f with -d$'\n'
commits v8.20-98-g51ce0bf and v8.20-99-gd302aed changed cut(1)
to process each line independently and thus promptly output
each line without buffering. As part of those changes we removed
the special handling of --delimiter=$'\n' --fields=... which
could be used to select arbitrary (ranges of) lines, so as to
simplify and optimize the implementation while also matching the
behavior of different cut(1) implementations.
However that GNU behavior was in place for a long time, and
could be useful in certain cases like making a separated list like
`seq 10 | cut -f1- -d$'\n' --output-delimiter=,` although other tools
like head(1) and paste(1) are more suited to this operation.
This patch reinstates that functionality but restricts the
"line behind" buffering behavior to only the -d$'\n' case.
We also fix the following related edge case to be more consistent:
before> printf "\n" | cut -s -d$'\n' -f1- | wc -l
2
before> printf "\n" | cut -d$'\n' -f1- | wc -l
1
after > printf "\n" | cut -s -d$'\n' -f1- | wc -l
1
after > printf "\n" | cut -d$'\n' -f1- | wc -l
1
* src/cut.c (cut_fields): Adjust as discussed above.
* tests/misc/cut.pl: Likewise.
* NEWS: Mention the change in behavior both for v8.21
and this effective revert.
* cfg.mk (old_NEWS_hash): Adjust for originally omitted v8.21 entry.
* src/paste.c: s/delimeter/delimiter/ comment typo fix.
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions