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!

Get process names 1

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
0
0
ES
Hello everybody,

I need to get the process names 'tt' in a script. For this reason I was doing:
ps -ef |grep tt |grep -v tt | awk '{print $9}'
but I have a problem because if the process has been started today the process name is in 8th column, but if it has been started another day before this value belongs in the 9th column. ¿How can I get the process names independently of when it has been started?

For example:
aaaa 737370 2355264 0 08:40:27 - 0:00 tt_ujmyhn
bbbb 995376 1 0 Oct 10 - 0:11 tt_qazwsx
bbbb 1245242 1 0 Oct 10 - 0:16 tt_edcrfv

I need to get: tt_ujmyhn, tt_qazwsx and tt_edcrfv

Thank you very much.
 
A starting point:
Code:
ps -fe | awk '$NF~/^tt/{print $NF}'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Or ps -eo comm | grep ^tt_.

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top