Because of the double evaluation of remote code (once by the local shell and once by the remote shell), it is advisable to have the remote code as short and simple as possible.
So the suggestion
Code:
ssh $hosts -qnx /sbin/ip a | awk ...
is a good one, because the remote code is only
/sbin/ip a
and the code after the pipe is local.
Note that I did -qnx options.
The -t option can be problematic; many sshd default to DOS CR-LF line ends if the terminal type is unknown, as shown with
Code:
TERM="" ssh -t remotehost "ls; uname -a" | cat -v
Looks like a bug of course.