Need a help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need a help
# 1  
Old 11-24-2008
Need a help

Hi!
I run ps -e -o "time pid" | sort -n command for sorting and need to take only long processes (in this case they will be in format XX:XX:XX (case hours) or XX-XX:XX:XX ( addition days)).
I try with grep -i ":{2}" but without succsess.
ps -e -o "time pid" | sort -n | grep -i ":{2}"
OS Solaris 2.8.
Thanks Stas.
Any help will be appreciative.
P.S I have example -> 5-21:40:13 or 18:36:40 and if I eliminate 14:46 (only minutes with second) I will calculate working hours of process

Last edited by beckss; 11-24-2008 at 05:48 AM..
# 2  
Old 02-03-2009
I believe the regexp you want is:
Code:
egrep "([0-9][0-9]-)?[0-9][0-9]:[0-9][0-9]:[0-9][0-9]"

For performance, I would do the sort after the grep.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question