Skip to main content
Question

Remove Printer Sctip

  • February 6, 2015
  • 1 reply
  • 1 view

Forum|alt.badge.img+3

Hi,

I'm trying to deploy a script that will remove specific printers. The problem I'm running into is that not all of them are named the same. For example, we have Printer1_Ricoh and Printer1_Ricoh_Bob. I'm using lpadmin -x Printer1_Ricoh in the script, but that doesn't get rid of it from people who have it named Printer1_Ricoh_Bob or Printer1_Ricoh_Joe. Is there a way to do the lpadmin command to remove a printer with a regular expression/wild card? Such that it will remove any printer with a name that contains Printer1_Ricoh.

Thanks in advance.

1 reply

Forum|alt.badge.img+3
  • Author
  • New Contributor
  • February 6, 2015

If anyone is interested, I found a solution:

lpstat -p | cut -d' ' -f2 | grep Printer1_Ricoh | xargs -I{} lpadmin -x {}