Script to find what netprinters are configured with what model

I had a more complicated script written a long time ago to find out this information,
but after realizing due to VBE's post (thank you VBE) that I could get all the info I
required in one place, I've reworked that into this simple script. Perhaps this will help?

#!/bin/sh
# hp-ux 11.11
 
# Script will return the IP Address, Model Script and
# the MIO# for all printers configured on the system.
 
# script uses 'eval' to set the variables PERIPH (ip address), MODELSCRIPTNAME
#and PRINTERCFG (mio#) that exist in each printer interface.  If one or more of the
#variables are not found, that information will be left blank, but the printer name
#will be printed.
 
#
# Create Header
#
 
Hptr=PRINTER
HIPA='IP ADDR'
HMOD=Model
HMIO=MIO#
printf '%-10s%-20s%-20s%-10s\n' "$Hptr" "$HIPA" "$HMOD" "$HMIO"
 
IDIR=/etc/lp/interface
 
cd ${IDIR}
 
for ptr in *
do
 if [[ -f $ptr ]]
 then
   # set PERIPH, MODELSCRIPTNAME & PRINTERCFG found in printer interface
   eval $(grep -E "^PERIPH=|MODELSCRIPTNAME=|PRINTERCFG=" $ptr | xargs | tr ' ' ';')
   PRINTERCFG=${PRINTERCFG##*/}
   PRINTERCFG=${PRINTERCFG%%\.cfg}
   printf '%-10s%-20s%-20s%-10s\n' "$ptr" "$PERIPH" "$MODELSCRIPTNAME" "$PRINTERCFG"
   unset -v PERIPH MODELSCRIPTNAME PRINTERCFG
 fi
done
 
cd -