Thursday, March 12, 2015

generate FQDN - with one liner

# cat hostname.txt

host1
host2
host3
host4

Once you run the for loop you should see something like below:

# for host in `cat hostname.txt`; do  ssh -oStrictHostKeyChecking=no $host host $host ; done | awk '{print $1}'

host1.example.com
host2.example.com
host3.example.com
host4.example.com

The output will change based on the domain name your servers are in.