[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Missing newline in cut from textutils-2.1

From: Scott Herod
Subject: Missing newline in cut from textutils-2.1
Date: Mon Nov 11 23:14:06 2002


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 ","

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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]