Match printer URI from ippfind with a printer listed in lpstat -p?

@robertfern - I’m sorry: I meant to write that the strings I quoted were in fact the fourth item in each case. I’ll try this on a Montery partition and report back.

@robertfern - And here is the full output from the lpstat part of your code on a Monterey system with three printers installed (I’ve obscured one name in the first string):

{{"Abcdef_LaserJet_400_MFP_M425dn", " dnssd://Abcdef%20LaserJet%20400%20MFP%20M425dn._ipp._tcp.local./?uuid=434e4638-4837-5139-4b4d-5820b14df350
", "82:b:14:df:35:
"}, {"Dining_Room_LaserJet_M203dw", " dnssd://Dining%20Room%20LaserJet%20M203dw._ipps._tcp.local./?uuid=564e4233-4730-3335-3835-e8d8d17c268c
", "8d:8d:17:c2:68:c
"}, {"HP_LaserJet_P3010_Series", " dnssd://HP%20LaserJet%20P3010%20Series%20%5B13EF70%5D._printer._tcp.local./BINPS", "lo:ca:l.:/B:IN:PS"}}

and here is the end of the raw upstate -l -p -v output:

device for Abcdef_LaserJet_400_MFP_M425dn: dnssd://Abcdef%20LaserJet%20400%20MFP%20M425dn._ipp._tcp.local./?uuid=434e4638-4837-5139-4b4d-5820b14df350
device for Dining_Room_LaserJet_M203dw: dnssd://Dining%20Room%20LaserJet%20M203dw._ipps._tcp.local./?uuid=564e4233-4730-3335-3835-e8d8d17c268c
device for HP_LaserJet_P3010_Series: dnssd://HP%20LaserJet%20P3010%20Series%20%5B13EF70%5D._printer._tcp.local./BINPS

Can you do a text dump of the raw output of both of your commands?

@robertfern - Here you are, but I think I’ve found the answer elsewhere:

ippfind:

ipp://LJ-M425dn-Abcdef.local:631/ipp/print
ipp://DiningRoomLaserJet.local:631/ipp/print
ipp://LJ-P3015-Edward.local:631/LJ-P3015-Edward

lpstat -l -p -v:

printer Abdef_LaserJet_400_MFP_M425dn is idle.  enabled since Mon Jan 15 21:07:29 2024
	Form mounted:
	Content types: any
	Printer types: unknown
	Description: Abdef LaserJet 400 MFP M425dn
	Alerts: none
	Location: 
	Connection: direct
	Interface: /private/etc/cups/ppd/Abdef_LaserJet_400_MFP_M425dn.ppd
	On fault: no alert
	After fault: continue
	Users allowed:
		(all)
	Forms allowed:
		(none)
	Banner required
	Charset sets:
		(none)
	Default pitch:
	Default page size:
	Default port settings:
printer Dining_Room_LaserJet_M203dw is idle.  enabled since Mon Jan 15 21:08:15 2024
	Form mounted:
	Content types: any
	Printer types: unknown
	Description: Dining Room LaserJet M203dw
	Alerts: none
	Location: Dining Room
	Connection: direct
	Interface: /private/etc/cups/ppd/Dining_Room_LaserJet_M203dw.ppd
	On fault: no alert
	After fault: continue
	Users allowed:
		(all)
	Forms allowed:
		(none)
	Banner required
	Charset sets:
		(none)
	Default pitch:
	Default page size:
	Default port settings:
printer HP_LaserJet_P3010_Series is idle.  enabled since Mon Jan 15 21:08:35 2024
	Form mounted:
	Content types: any
	Printer types: unknown
	Description: HP LaserJet P3010 Series
	Alerts: none
	Location: 
	Connection: direct
	Interface: /private/etc/cups/ppd/HP_LaserJet_P3010_Series.ppd
	On fault: no alert
	After fault: continue
	Users allowed:
		(all)
	Forms allowed:
		(none)
	Banner required
	Charset sets:
		(none)
	Default pitch:
	Default page size:
	Default port settings:
device for Abdef_LaserJet_400_MFP_M425dn: dnssd://Abdef%20LaserJet%20400%20MFP%20M425dn._ipp._tcp.local./?uuid=434e4638-4837-5139-4b4d-5820b14df350
device for Dining_Room_LaserJet_M203dw: dnssd://Dining%20Room%20LaserJet%20M203dw._ipps._tcp.local./?uuid=564e4233-4730-3335-3835-e8d8d17c268c
device for HP_LaserJet_P3010_Series: dnssd://HP%20LaserJet%20P3010%20Series%20%5B13EF70%5D._printer._tcp.local./BINPS

But the answer may be something like this:

lpstat -v produces, among other things,

device for Dining_Room_LaserJet_M203dw: dnssd://Dining%20Room%20LaserJet%20M203dw._ipps._tcp.local./?uuid=564e4233-4730-3335-3835-e8d8d17c268c

dns-sd -B _ipp._tcp local. produces, among other things:

21:24:10.999  Add        3  11 local.               _ipp._tcp.           Dining Room LaserJet M203dw

Then: dns-sd -L "Dining Room LaserJet M203dw" _ipp._tcp local. produces:

Dining\032Room\032LaserJet\032M203dw._ipp._tcp.local. can be reached at DiningRoomLaserJet.local.:631 (interface 11)
 txtvers=1 qtotal=1 pdl=image/urf,application/PCLm,application/octet-stream,application/pdf,application/postscript,application/vnd.hp-PCL,application/vnd.hp-PCLXL,image/jpeg rp=ipp/print URF=V1.4,CP99,W8,OB10,PQ3-4-5,DM1,IS1,MT1-3-5,RS600 ty=HP\ LaserJet\ M203-M206 product=\(HP\ LaserJet\ M203-M206\) priority=10 adminurl=http://DiningRoomLaserJet.local./hp/device/info_config_AirPrint.html\?tab=Networking\&menu=AirPrintStatus note=Dining\ Room Color=F Duplex=T Scan=F Fax=F UUID=564e4233-4730-3335-3835-e8d8d17c268c kind=document,envelope,photo PaperMax=legal-A4 TLS=1.2 usb_MFG=HP usb_MDL=HP\ LaserJet\ M203-M206 mac=e8:d8:d1:7c:26:8c mopria-certified=1.3

This includes DiningRoomLaserJet.local

The command dns-sd -Gv4 DiningRoomLaserJet.local produces:

21:39:45.802  Add        3 11 DiningRoomLaserJet.local.              192.168.1.23                                 120
21:39:45.802  Add        2 11 DiningRoomLaserJet.local.              FE80:0000:0000:0000:EAD8:D1FF:FE7C:268C%en0  120

There’s a lot of parsing and matching to do, but this gets the job done entirely with internal commands. Also, all the commands are interactive, so there would need to be some way to exit them after they’ve produced output. These ways seem to exist, but I don’t know them.