HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how can I get correct output of time command
Operating System - HP-UX
1829161
Members
10241
Online
109986
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
11-13-2007 01:46 AM
11-13-2007 01:46 AM
how can I get correct output of time command
time my_command gives me correct output. but time my_command|grep something gives me output which also includes time taken by grep. How can i avoid this.
[root@XXXXX]#time vxdisk list
real 0m0.013s
user 0m0.003s
sys 0m0.003s
[root@XXXXX]#time vxdisk list|sleep 5|grep real
real 0m5.002s
user 0m0.004s
sys 0m0.004s
[root@XXXXX]#
[root@XXXXX]#time vxdisk list
real 0m0.013s
user 0m0.003s
sys 0m0.003s
[root@XXXXX]#time vxdisk list|sleep 5|grep real
real 0m5.002s
user 0m0.004s
sys 0m0.004s
[root@XXXXX]#
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2007 01:50 AM
11-13-2007 01:50 AM
Re: how can I get correct output of time command
Shalom,
Break the command into two parts.
time vxdisk list > file
grep real file
SEP
Break the command into two parts.
time vxdisk list > file
grep real file
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2007 02:01 AM
11-13-2007 02:01 AM
Re: how can I get correct output of time command
Try using /usr/bin/time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2007 02:24 AM
11-13-2007 02:24 AM
Re: how can I get correct output of time command
First, "sleep" is not a filter. Piping
output through "sleep" does not work.
Sub-shell?
( time vxdisk list ) 2>&1 | grep real
"man time":
[...]
The times are printed on standard error.
[...]
I assume that you wanted the "grep" to work.
Of course, it also says this:
Note that the shell also has a keyword time that times an entire
pipeline if used anywhere in the pipeline, unlike time(1) command
which times a particular command if used in a pipeline.
So, you might want something more like:
/usr/bin/time vxdisk list 2>&1 | grep real
(Or, when you see the results, you might
not.)
output through "sleep" does not work.
Sub-shell?
( time vxdisk list ) 2>&1 | grep real
"man time":
[...]
The times are printed on standard error.
[...]
I assume that you wanted the "grep" to work.
Of course, it also says this:
Note that the shell also has a keyword time that times an entire
pipeline if used anywhere in the pipeline, unlike time(1) command
which times a particular command if used in a pipeline.
So, you might want something more like:
/usr/bin/time vxdisk list 2>&1 | grep real
(Or, when you see the results, you might
not.)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP