Removes all newlines from output. Checks the command output as well so as to turn newlines into spaces, with the exception of the last character of the output. 

Noticed that when submitting checks on a busy sensu client the newlines would cause sensu to report malformed json errors. These changes remove all newlines from the output and check the output of the command so as to change newlines to spaces (with the exception of the last character). This gives us one long json string to submit. I am not longer seeing errors with this version of the script.