Subject: cut 8.22 adds newline
From: John Kendall <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Mon, 1 Dec 2014 13:39:38 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I don't know if this is a bug, but I wonder if there is a consensus on correct behavior.
The solaris version of cut does not add a newline if there was no newline on the input:

Consider this printf command:

$ printf "1\n12\n123\n1234\n12345\n123456"
1
12
123
1234
12345
123456$

Note that the shell prompt appears after the 6 on the last line.

# Solaris cut
$ printf "1\n12\n123\n1234\n12345\n123456" | cut -c1-4
1
12
123
1234
1234
1234$

Note that the shell prompt appears after the 4 on the last line.

#gnu 8.22 cut
/$ printf "1\n12\n123\n1234\n12345\n123456" | cut -c1-4
1
12
123
1234
1234
1234
$

Note that the shell prompt appears on its own line.

I came upon this while porting scripts from Solaris 10 to Centos 7.

Interested to hear you thoughts.

Thanks and best regards,
John
---
John Kendall
System Administrator
CAI International