Linux / UNIX Tech Support Forum
This is a discussion on list path for apache process with great cpu usage within the Shell scripting forums, part of the Development/Scripting category; Hy, I tryed this for a in `ps -eo pid,pcpu,comm | sort -n -k2 | grep 'httpd'|tail -10|awk '{print $1}'`; ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hy,
I tryed this for a in `ps -eo pid,pcpu,comm | sort -n -k2 | grep 'httpd'|tail -10|awk '{print $1}'`; do pwdx $a; done works but I want to also insert the cpu % in front something like: for a in `ps -eo pid,pcpu,comm | sort -n -k2 | grep 'httpd'|tail -10|awk '{print $2 " " $1}'`; do pwdx $a; done but $a takes both values. how can this be donne? Thanks, Cosmin |
| Sponsored Links | ||
|
|
|
|||
|
Thanks for the solution, this would work in an script but I would prefer to run it as a single line command, I need to run it on several servers.
|
|
||||
|
Quote:
Code:
ps -eo pid,pcpu,comm | sort -n -k2 | grep 'httpd'|tail -10|awk '{ORS="% "; system("pwdx " $1); print $2}'
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| awk , bash , pipes , ps command , pwdx |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can I set Path in bash shell | chanderbio | Shell scripting | 2 | 13-06-2008 10:38 AM |
| Change /tmp path on KDE as it is too small for KDE | marccarter0 | Ubuntu / Debian | 2 | 26-05-2008 09:34 PM |
| CPU usage Shell script (Monitoring CPU Usage) | atulmatkar | Shell scripting | 2 | 10-05-2008 10:24 PM |
| Killing of a process and send a mail if the process doesnot come up within 2 minutes | Prince89 | Shell scripting | 1 | 11-02-2008 12:39 PM |
| vivek: thanks for a great site | fragbait | The Hangout | 3 | 14-12-2006 05:13 PM |