Awk + print awk output in one line

awkksh

When I run the following hasys command with awk , I get output with machines names as the following:

hasys -display|grep Shutdown | awk '{print $1}'
  machine1a
  machine1b

please advice how to print the machines names in one line as the following: example

hasys -display|grep Shutdown | awk '{print $1}'

    machine1a machine1b

what I need to add in my awk syntax so I will able to print the names in one line?

Best Answer

You can say:

hasys -display | grep Shutdown | awk '{print $1}' ORS=' '
Related Question