Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printer list export

Status
Not open for further replies.

gatetec

MIS
Mar 22, 2007
420
US
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
 
Please don't cross post - you're getting answers in the Unix scripting forum.

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top