Sponsored Content
Top Forums UNIX for Advanced & Expert Users ps avg | grep ? filter the desired out put. Post 302302866 by varungupta on Wednesday 1st of April 2009 08:02:04 AM
Old 04-01-2009
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.
Code:
ps avg | grep Data

This command will show the processes with its PID as :
Code:
PID   TTY  STAT  TIME   PGIN SIZE  RSS    LIM  TSIZ   TRS %CPU %MEM COMMAND 
  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
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Put the output of grep in a variable

Hi, in a shell script how can I put the result of a grep command in a variable : myvariable=grep mystring myfilename Thank you. (3 Replies)
Discussion started by: big123456
3 Replies

2. Solaris

How to grep (say)last-3 and next-3 lines of Desired Pattern

Hi All, OS-Type=Sun-OS 5.8 Sparc9 Processor Can I grep the previous 4 lines and next 4 lines of a matched pattern(context grep)? For example here we need to monitor logs of live traffic.The data obtained from "tail -f LiveTrafficData.log" looks something like this:-... (3 Replies)
Discussion started by: Sujan Banerjee
3 Replies

3. Shell Programming and Scripting

Grep script to filter

Hi, Wondering if anyone could help me with a simple script to filter out multiple things from a file. Right now I just have long lines of grep -v remove file | greg -v etc etc What I would like to do is have grep -v <run everything in a file> tofilter If that makes sense. Basically a... (2 Replies)
Discussion started by: kevin9
2 Replies

4. Shell Programming and Scripting

filter grep command

I have ran into a small issue and I am not sure how to fix it. In one of our current scripts we have this line which does a grep to get the pid of the process. ps -ef | grep nco_p_syslog | grep $x | awk '{print $2}' However this is not returning anything due to the how long the value... (7 Replies)
Discussion started by: LRoberts
7 Replies

5. Shell Programming and Scripting

Filter on a grep

I am attempting to figure out how to only capture part of a grep command I am doing. So far no luck. When I execute.... leviathan:/gfs/home/tivoli>ps -ef | /usr/ucb/ps -auxww | grep nco_p_syslog The results are.... tivoli 10185 0.0 0.0 5888 5168 ? S Oct 23 0:26... (2 Replies)
Discussion started by: LRoberts
2 Replies

6. UNIX for Advanced & Expert Users

filter last 24 hour data and put in new file

i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81) Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in another unix box(say ip adress of the box 10.39.66.82). Now my... (1 Reply)
Discussion started by: nripa1
1 Replies

7. Shell Programming and Scripting

ls | grep (i dont know what to put here)

Dear users, I googled for a while, but i have got a lot of different answers regarding a simple unix command. lets say there are a lot of files in a directory. How can i list the files in a directory whose file types is "text"? Thank you in advance (4 Replies)
Discussion started by: kevincobain2000
4 Replies

8. Shell Programming and Scripting

Grep regex filter

Hi, How can I run the grep search in a script to only include compute, not bigcomputer in following search input? " properties = local compute" " properties = local bigcompute" Thank you. -j (6 Replies)
Discussion started by: hce
6 Replies

9. Shell Programming and Scripting

Filter pattern in grep command

Hi, I am having a file like below hello how are you hello... (5 Replies)
Discussion started by: rohit_shinez
5 Replies

10. UNIX for Beginners Questions & Answers

Grep -P does not capture the desired output

Hi, I'm trying to filter the following output to only display information about an alarm where the Status: corresponds to Set. -------------------------------------------------------- Description: hw_optics: RX POWER LANE-0 LOW ALARM Location: Optics0/0/0/21... (6 Replies)
Discussion started by: sand1234
6 Replies
dapptrace(1m)							   USER COMMANDS						     dapptrace(1m)

NAME
dapptrace - trace user and library function usage. Uses DTrace. SYNOPSIS
dapptrace [-acdeFlhoU] [-u lib] { -p PID | command } DESCRIPTION
dapptrace prints details on user and library function calls. By default it traces user functions only, options can be used to trace library activity. Of particular interest is the elapsed times and on cpu times, which can identify both function calls that are slow to complete, and those which are consuming CPU cycles. Since this uses DTrace, only users with root privileges can run this command. OPTIONS
-a print all details -b bufsize dynamic variable buffer size. Increase this if you notice dynamic variable drop errors. The default is "4m" for 4 megabytes per CPU. -c print function call counts -d print relative timestamps, us -e print elapsed times, us -F print flow indentation -l force printing of pid/lwpid per line -o print on-cpu times, us -p PID examine this PID -u lib trace this library instead -U trace all library and user functions EXAMPLES
run and examine the "df -h" command, # dapptrace df -h examine PID 1871, # dapptrace -p 1871 print using flow indents, # dapptrace -Fp 1871 print elapsed and CPU times, # dapptrace -eop 1871 FIELDS
PID/LWPID Process ID / Lightweight Process ID RELATIVE relative timestamps to the start of the thread, us (microseconds) ELAPSD elapsed time for this system call, us CPU on-cpu time for this system call, us CALL(args) function call name, with some arguments in hexadecimal DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver- bose descriptions explaining the output. EXIT
dapptrace will run forever until Ctrl-C is hit, or if a command was executed dapptrace will finish when the command ends. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
dappprof(1M), dtrace(1M), apptrace(1) version 1.10 May 14, 2005 dapptrace(1m)
All times are GMT -4. The time now is 04:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy