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

sorting "etimes" on ps output 1

Status
Not open for further replies.

w5000

Technical User
Nov 24, 2010
223
0
0
PL

hello,

"ps -ef -o etime" command on AIX returns the elapsed time since the process started.

[[ dd-]hh:]mm:ss

and returns, for example:

Code:
      18:22
57-10:09:09
52-04:03:56
10-13:29:12
   04:19:02
52-04:02:33
      18:22
      06:54
15-17:36:56
      03:40
      03:40
 4-05:16:38
      06:47
57-10:08:29
      03:39
17-18:04:31
52-04:03:56
   12:59:24
52-04:02:36
82-23:19:40
52-04:03:33
   04:34:33
17-18:04:34
      51:31
13-21:26:04
 3-23:02:04
52-04:02:40
82-23:19:40
52-04:04:23
52-04:02:42
      00:05
      08:30
41-04:52:56
52-04:03:57
52-03:43:34
   04:34:27


Q: How to sort output to get "etimes" listed from the oldest to the latest?


regards,m.

 
A starting point:
ps -ef -o etime | awk '{print substr("00-00:",1,11-length($1))$1}' | sort -r

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
it is perfect!
thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top