perl -pe 'eof and chomp'
利用例
$ seq 3 | perl -pe 'eof and chomp' 1 2 3$
sed -z '$s/\n$//'
-z オプションは GNU sed のみなので、macの場合は gsed を使おう