I created this script which generates the following output:
### NODE 1 ###
IP: 192.168.1.100
MASK: 225.255.255.0
GATEWAY: 192.168.1.1
### NODE 2 ###
IP: 192.168.1.101
MASK: 225.255.255.0
GATEWAY: 192.168.1.1
Is there any way to force the output to look like this instead?
### NODE 1 ### ### NODE 2 ###
IP: 192.168.1.100 IP: 192.168.1.101
MASK: 225.255.255.0 MASK: 225.255.255.0
GATEWAY: 192.168.1.1 GATEWAY: 192.168.1.1
CodePudding user response:
If you have an unknown number of nodes, the format you proposed is actually pretty bad because you'll run too wide with just several nodes. May I propose the following:
Node Name IP Netmask Gateway
Node 1 192.168.0.100 255.255.255.0 192.168.1.1
Node 2 192.168.0.101 255.255.255.0 192.168.1.1
But if you insist on the column per node format then I'd make use of arrays.
CodePudding user response:
You want the pr
command
/path/to/your/script | pr -2T