Creating a single line from output of multiple shell commands

Viewed 1590

I try to ssh to multiple hosts (thousands of them), capture some command output and write in a file. But output of all command should be in same line, comma separated, space separated, anything but in same line for each host.

So my commands are like":

ssh $host "hostname; uname -r; echo mypassword| sudo -S ipmitool mc info | grep 'Firmware Revision' " > ssh.out

But if I use like this, it will write all command output to separate lines. (3 lines per host). But all I want is only one line per host, let's say:

myserver,3.2.45-0.6.wd.514,4.3 (comma or any field separator is fine)

How I can do this?

3 Answers
Related