ps avg | grep ? filter the desired out put. | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    

UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

ps avg | grep ? filter the desired out put.

UNIX for Advanced & Expert Users

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 04-01-2009
varungupta varungupta is offline
Registered User
Join Date: Feb 2007
Last Activity: 15 July 2010, 5:53 AM EDT
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Thanks: 0
Thanked 1 Time in 1 Post
ps avg | grep ? filter the desired out put.

Hi Folk,

Following is the command I used to get data related to the DataFlowEngine.
I wanted to know the % usage of cpu and memory.

ps avg | grep Data

This command will show the processes with its PID as :

  303248   - A    306:32  378 96628 77420    xx    20    56    0.0  0.0           DataFlo
  315404   - A     7:52   109 77944 51104     xx    20    56    0.0  0.0         DataFlo
  426060    - A    230:41  16 100196 100252  xx    20    56   0.1  0.0          DataFlo

Now I want the further details related to that PID that I can get after searching in ps -elf table.

How to use the output of above given command (ps avg | grep Data) as input to the ps -elf and then filter the PID and Process Name using one line command?
If script then it would be ok as well.
I know we can use awk or sed command to filter that.

Last edited by Yogesh Sawant; 04-07-2009 at 05:33 AM.. Reason: added code tags
Sponsored Links
Old 04-10-2009
TonyFullerMalv's Avatar
TonyFullerMalv TonyFullerMalv is offline Forum Advisor  
Registered User
Join Date: Sep 2008
Last Activity: 1 July 2013, 6:45 PM EDT
Location: Malvern, Worcs. U.K.
Posts: 1,033
Thanks: 0
Thanked 8 Times in 8 Posts

for DATAPID in `ps -avg | grep Data | awk '{ print $1 }'`; do
 ps -elf | grep ${DATAPID} | grep -v grep

Not an elegant one-liner but it might provide what you are after.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Grep script to filter kevin9 Shell Programming and Scripting 2 02-21-2009 01:59 AM
How to grep (say)last-3 and next-3 lines of Desired Pattern Sujan Banerjee Solaris 3 11-06-2008 05:01 AM
Desired Format ! prasanth_babu HP-UX 1 02-20-2008 10:31 AM
grep a log file to filter previous dates pinpe Shell Programming and Scripting 5 08-03-2007 02:25 PM
Filter results through pipe with grep ckandreou UNIX for Dummies Questions & Answers 1 07-10-2006 03:04 PM

All times are GMT -4. The time now is 02:52 AM.