tag 23922 notabug
close 23922
stop

Hello Jens,

> On Jul 8, 2016, at 19:05, Jens Mueller <jens.k.muel...@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








Reply via email to