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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lpstat - printers disable or enable

Status
Not open for further replies.

cantubas

Programmer
Jan 8, 2004
45
FR
i want to do a script that return me the status (disable or enable only) of my printers.
when i do "lpstat -p" i have:

printer th55_307 is idle. enabled since Apr 2 12:16
fence priority : 0
printer dj55_25 disabled since Jun 21 14:12 -
c'est pour essayer
fence priority : 0



when it is enable, enable is the 5th word and when it is disble it the 3rd.

if i use "grep able" it returns me the entire line whereas i want only disable or enable.
 
tres confus, quel est ls question ?
what are you looking for ?

:) guggach
 
Something like this ?
lpstat -p | nawk '/^printer /{sub(/ since .*/,"");print $1,$2,$NF}'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top