Delete printer that does not exist

IAmForum

Weaksauce
Joined
Jan 17, 2020
Messages
94
I do the command
lpstat -t -l
device for br2_warehouse: socket://192.168.2.52:9100
device for br3_counter: socket://192.168.3.51:9100
device for br3_label: socket://192.168.3.53:9100
device for br3_sales: socket://192.168.3.10:9100
device for br3_shipping: socket://192.168.3.54:9100
device for br3_warehouse: socket://192.168.3.52:9100
device for br4_counter: socket://192.168.4.51:9100

br2_warehouse accepting requests since Wed 31 May 2023 02:45:16 PM EDT
br3_counter accepting requests since Wed 31 May 2023 02:39:06 PM EDT
br3_label accepting requests since Tue 11 Apr 2023 12:04:51 PM EDT
br3_sales accepting requests since Wed 31 May 2023 02:31:33 PM EDT
br3_shipping accepting requests since Tue 30 May 2023 03:14:34 PM EDT
br3_warehouse accepting requests since Wed 31 May 2023 02:45:14 PM EDT
br4_counter accepting requests since Wed 31 May 2023 02:35:43 PM EDT

printer br2_warehouse is idle. enabled since Wed 31 May 2023 02:45:16 PM EDT
printer br3_counter is idle. enabled since Wed 31 May 2023 02:39:06 PM EDT
printer br3_label is idle. enabled since Tue 11 Apr 2023 12:04:51 PM EDT
printer br3_sales is idle. enabled since Wed 31 May 2023 02:31:33 PM EDT
printer br3_shipping is idle. enabled since Tue 30 May 2023 03:14:34 PM EDT
printer br3_warehouse is idle. enabled since Wed 31 May 2023 02:45:14 PM EDT
printer br4_counter is idle. enabled since Wed 31 May 2023 02:35:43 PM EDT

I do this command
cat /etc/hosts
192.168.2.52 br2_warehouse
192.168.3.10 br3_sales
192.168.3.50 br3_office
192.168.3.51 br3_counter
192.168.3.52 br3_warehouse
192.168.4.51 br4_counter

How do I delete the printer "192.168.3.50 br3_office" ?
 
I have no idea what you're asking here. Are you asking how to edit /etc/hosts?
 
If that's the goal, sed would be a lot quicker.
Code:
sed --in-place '/192.168.3.50 br3_office/d' /etc/hosts

or awk. Or lots of options xD vim works as well of course, but even there no need to go into interactive mode... just vim, arrow down to the line, then dd, then :wq.
 
Back
Top