title: Using awk to format an output for nstats
body: <p>I would like to get a complete hostname with their server up-time using "nstats" command. The script appears to be working ok. I need help with the 1st column with a "complete" hostname and the 7th column (server up-time) printed.</p>
  
  <p><strong>This following command only give me their partial hostnames:</strong></p>
  
  <pre><code> for host in $(cat servers.txt); do nstats $host -H | awk 'BEGIN {IFS="\t"} {$2=$3=$4=$5=$6=$9="" ; print}' ; done
  </code></pre>
  
  <p><strong>BAD Output</strong>: (host-names got cut off after the 12th characters)</p>
  
  <pre><code> linux_server  223 days
   linux_server  123 days
   windows_serv  23 days
   windows_serv  23 days
  </code></pre>
  
  <p><strong>EXPECTED Output</strong>:</p>
  
  <pre><code> linux_server1   223 days
   linux_server2   123 days
   windows_server1  23 days
   windows_server2  123 days
  </code></pre>
  
  <p><strong>The contents of servers.txt file are as follows:</strong></p>
  
  <pre><code> linux_server1
   linux_server2
   windows_server1
   windows_server2
  </code></pre>
  
  <p><strong>Output without awk</strong></p>
  
  <pre><code> LINXSERVE10% for host in $(cat servers.txt); do nstats $host -H ; done
   linux_server   0.01    47%    22%    56  05:08  20 days 17:21:00
   linux_server   0.00    23%     8%    45  05:08  24 days 04:16:46
   windows_serv   0.04    72%    30%    58  05:09 318 days 23:32:17
   windows_serv   0.00    20%     8%    40  05:09 864 days 12:23:10
   windows_serv   0.00    51%    17%    41  05:09 442 days 05:30:14
  </code></pre>
  
  <p>Note: <code>for host in $(cat servers.txt); do nstats $host -H | awk -v server=$host 'BEGIN {IFS="\t"} {$2=$3=$4=$5=$6=$9="" ; print server }' ; done</code> *** this works ok but it will list only a complete hostname with no server uptime.</p>
  
  <p>Any help you can give would be greatly appreciated.</p>