Can anyone help on this , please?
I have this script and like to have the output in a delimiter format (with tab or special character) like below so that I can import the list into Excel w/o reformatting it manually.
Queue Name Device Name Hostname IP Pingble
g3k41p1 hp@g3k41-ps1 g3k41-ps1 10.2.3.129 Pingble
q3k41p9 hp@q3k41-ps9 q3k41-ps9 15.2.3.129 Not-Pingble
….
thx much
for i in `lsallq`
do
echo "Queue Name: " $i
echo "----------------------------------------"
for j in `lsallqdev -q $i`
do
echo " Device Name:" $j
hname=`echo $j | cut -f2 -d"@"`
echo " Hostname :" $hname
ip=`nslookup $hname 2>&1 | awk '/^Address/ {print $2}' | tail -n1`
if ping -c 1 $ip > /dev/null 2>&1; then
echo " IP :" $ip Pingble.
PINGABLE="$PINGABLE $hname[$ip]($i)"
else
echo " IP :" $ip Not Pingble.
UNPINGABLE="$UNPINGABLE $hname[$ip]($i)"
fi
echo ""
done
echo ""
done
I have this script and like to have the output in a delimiter format (with tab or special character) like below so that I can import the list into Excel w/o reformatting it manually.
Queue Name Device Name Hostname IP Pingble
g3k41p1 hp@g3k41-ps1 g3k41-ps1 10.2.3.129 Pingble
q3k41p9 hp@q3k41-ps9 q3k41-ps9 15.2.3.129 Not-Pingble
….
thx much
for i in `lsallq`
do
echo "Queue Name: " $i
echo "----------------------------------------"
for j in `lsallqdev -q $i`
do
echo " Device Name:" $j
hname=`echo $j | cut -f2 -d"@"`
echo " Hostname :" $hname
ip=`nslookup $hname 2>&1 | awk '/^Address/ {print $2}' | tail -n1`
if ping -c 1 $ip > /dev/null 2>&1; then
echo " IP :" $ip Pingble.
PINGABLE="$PINGABLE $hname[$ip]($i)"
else
echo " IP :" $ip Not Pingble.
UNPINGABLE="$UNPINGABLE $hname[$ip]($i)"
fi
echo ""
done
echo ""
done