Removed reliance on trailing newlines for piped input (useful for things like xclip -o)