- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Formatting output
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:11 AM
01-31-2006 11:11 AM
Formatting output
i am using the following script
for i in $(cat /home/mayub/script/printer_name.txt)
do
x=`lpstat -p$i |grep idle`
echo $x
done
The oupput is
printer ausyd01pr305 is idle. enabled since Dec 8 11:07 printer ausyd01pr315 is idle. enabled since Dec 8 11:09 printer ausyd01pr300 is idle. enabled since Jan 24 16:02 printer ausyd01pr306 is idle. enabled since Jan 27 16:37 printer ausyd01pr307 is idle. enabled since Jan 27 16:38 printer ausyd01pr308 is idle. enabled since Jan 27 16:38 printer ausyd01pr311 is idle. enabled since Jan 27 16:39 printer ausyd01pr312 is idle. enabled since Jan 27 16:39 printer ausyd01pr314 is idle. enabled since Jan 27 16:40 printer ausyd01pr330 is idle. enabled since Jan 27 16:40 printer ausyd01pr336 is idle. enabled since Jan 27 16:41 printer ausyd01pr344 is idle. enabled since Jan 27 16:41 printer ausyd01pr345 is idle. enabled since Jan 27 16:42 printer ausyd01pr350 is idle. enabled since Jan 27 16:42 printer ausyd01pr353 is idle. enabled since Jan 27 16:43 printer ausyd01pr359 is idle. enabled since Jan 27 16:43 printer ausyd01pr363 is idle. enabled since Jan 27 16:44 printer ausyd01pr364 is idle. enabled since Jan 27 16:44 printer ausyd01pr365 is idle. enabled since Jan 27 16:45 printer ausyd01pr369 is idle. enabled since Jan 27 16:46 printer ausyd01pr370 is idle. enabled since Jan 27 16:46 printer ausyd01pr372 is idle. enabled since Jan 27 16:47 printer ausyd01pr380 is idle. enabled since Jan 27 16:47 printer ausyd01pr401 is idle. enabled since Jan 27 16:48 printer ausyd01pr351 is idle. enabled since Jan 30 16:12
I want out put like that
printer ausyd01pr305 is idle. enabled since Dec 8 11:07
printer ausyd01pr315 is idle. enabled since Dec 8 11:09
printer ausyd01pr300 is idle. enabled since Jan 24 16:02
printer ausyd01pr306 is idle. enabled since Jan 27 16:37
so on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:14 AM
01-31-2006 11:14 AM
Re: Formatting output
Change your script a bit.
x=`lpstat -p$i |grep idle`
echo $x
instead use
echo $x >> /tmp/p.out
Also each time before starting
rm /tmp/p.out
Chan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:33 AM
01-31-2006 11:33 AM
Re: Formatting output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:37 AM
01-31-2006 11:37 AM
Re: Formatting output
That should solve your problem
Chan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:41 AM
01-31-2006 11:41 AM
Re: Formatting output
what will be the syntext
lpstat -p$i |grep idle \n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:48 AM
01-31-2006 11:48 AM
Re: Formatting output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:53 AM
01-31-2006 11:53 AM
Re: Formatting output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 05:04 PM
01-31-2006 05:04 PM
Re: Formatting output
while read printer;
do
lpstat -i${printer} | grep idle
done < /home/mayub/script/printer_name.txt
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 05:07 PM
01-31-2006 05:07 PM