As suggested by Stéphane Chazelas in the accepted answer, you can now
create a script /usr/local/bin/trim:
#!/bin/bash
awk '{$1=$1};1'
and give it that file execulableexecutable rights:
chmod +x /usr/local/bin/trim
Now you can pass every output to trim for example:
cat file | trim
(for the comments below: i used this before: while read i; do echo "$i"; done
which also works fine, but is less performant)