Acclaimed Contributor Acclaimed Contributor
Re: ping status (extracting hostname)
[ Edited ]

>tes00101:prod:NO:10.01.23.45:tes00101:production:IDC-Secure SER

>I also need to display the sixth field in the output along with the hostname and ping status.

 

awk -F: -v network="IDC-Secure SER" '

$0 ~ network { print $5, $6 }

' /home/madhu/userdetail/hostdetails.txt | while read HOST H_STATUS; do

...

   echo  "${HOST} ${STAT} ${H_STATUS}"