Loop through column then row Loop through column then row unix unix

Loop through column then row


Bash can handle this task with ease:

#!/bin/bash# File: format_output.shwhile read server instancesdo    for instance in $instances    do        echo "Server: $server, Instance: $instance"    donedone

To use it:

$ bash format_output.sh < myfile.txt


If awk is allowed, something like

awk '{for(i=2;i<=NF;i++) print "Server: " $1 ", Instance: " $i }' < myfile.txt