GNU bug report logs -
#23922
cut fails for non-delimited input lines with -f 2
Previous Next
Reported by: Jens Mueller <jens.k.mueller <at> gmx.de>
Date: Fri, 8 Jul 2016 23:37:01 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23922 in the body.
You can then email your comments to 23922 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#23922
; Package
coreutils
.
(Fri, 08 Jul 2016 23:37:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jens Mueller <jens.k.mueller <at> gmx.de>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 08 Jul 2016 23:37:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
I'd like to report the following behavior of cut.
I execute
$ echo "abc" | cut -f 2 -d " "
and I expect the empty line as output but you get "abc\n".
I believe the empty line is correct because I selected the second
field which is empty.
If you select the 3rd field
$ echo "abc cde" | cut -f 3 -d " "
it outputs the empty line and works as expected which supports my
reasoning.
I am running Debian with
$ cut --version | head -1
cut (GNU coreutils) 8.25
Jens
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#23922
; Package
coreutils
.
(Sat, 09 Jul 2016 03:21:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 23922 <at> debbugs.gnu.org (full text, mbox):
tag 23922 notabug
close 23922
stop
Hello Jens,
> On Jul 8, 2016, at 19:05, Jens Mueller <jens.k.mueller <at> gmx.de> wrote:
>
> $ echo "abc" | cut -f 2 -d " "
>
> and I expect the empty line as output but you get "abc\n".
It is not a bug, but correct behavior (though perhaps unexpected) to print "abc" in this case.
The POSIX standard says (at
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html):
"-s
Suppress lines with no delimiter characters, when used with the -f option. Unless specified, lines with no delimiters shall be passed through untouched."
In GNU cut's help screen (cut --help) shows:
-s, --only-delimited do not print lines not containing delimiters
The following will demonstrate:
$ printf "abc\nd f\n" | cut -f2 -d " "
abc
f
$ printf "abc\nd f\n" | cut -s -f2 -d " "
f
As such, I'm closing this bug report - but discussion can continue by replying to this thread.
regards,
- assaf
Added tag(s) notabug.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sun, 28 Oct 2018 06:23:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
23922 <at> debbugs.gnu.org and Jens Mueller <jens.k.mueller <at> gmx.de>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sun, 28 Oct 2018 06:23:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 25 Nov 2018 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 206 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.