Take a look at chop and chomp.
In reply to Re: System output variables and newline by AppleFritter in thread System output variables and newline by Jocqui