Hello,

I noticed that the cut utility does not put a trailing newline on lines
when delimiter cutting from stdin is used.  As an example of this:

bash> cut -f 1,3 -d ","
a,b,c,d,e
a,c

The results are correct in that "a,c" is returned, but there is no
trailing newline.  This differs from the behavior if character or byte
cutting is selected:

bash> cut -c 1,3
a,b,c,d,e
ab

Here the line "ab" has a trailing newline.

I believe that the problem is with the while 'if' statement that begins on
line 523:

      if (c == '\n')
        {
          c = getc (stream);
          if (c != EOF)
            {
              ungetc (c, stream);
              c = '\n';
            }
        }

The getc on the third line blocks until new data is entered so that the
putchar('\n') a few lines further down is not reached.

I'm not sure of a clean fix at this point but will continue to look at it.

Thank you,

Scott Herod
[EMAIL PROTECTED]






_______________________________________________
Bug-textutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-textutils

Reply via email to