In Linux, you can use xargs -d, to quickly run the hostname command against four different servers with sequential names as follows:
echo -n 1,2,3,4 |xargs -d, -I{} ssh root@www{}.example.com hostname
It looks like the OSX xargs command does not support the delimiter parameter. Can you achieve the same result with a differently formatted echo, or through some other command-line utility?