# Process  Output of host command (from /tmp/hostnameinfo) and creates host, 
#    domain name (write in file /tmp/hostname)
#
# Command example
#     awk -fgethostname_awk /tmp/hostnameinfo > /tmp/hostname
#
#  Input:  /tmp/hostnameinfo (outout of exec host $ip)
#  Output: /tmp/hostname 
#             HOSTNAME=...
#
#          Output of successful host command - we want the 5th parm 
#             6.154.3.9.IN-ADDR.ARPA domain name pointer ncperf2.austin.ibm.com   
#          Typical output of unsuccessful host command             
#             Host not found.                                      
#

BEGIN { }

$0 !~ "Host not found" { 
            # process all the fields of the cmdline
            field = 5;
            printf("HOSTNAME=%s\n", $field); 
       }    # end statement

END { }
