Sponsored Content
Full Discussion: simple awk sort problem
Top Forums Shell Programming and Scripting simple awk sort problem Post 302577681 by delphys on Tuesday 29th of November 2011 03:04:30 PM
Old 11-29-2011
Code:
UNIX95=1 ps -ef -o pcpu,user,pid,args | (head -n1; sort -r -k 1,1) | head -10
 %CPU USER       PID COMMAND
f /u1/rjl/db.pf -p gnpr/gnmenum -q -mmax 1024
16.66 progress 22668 /usr/dlc/bin/_progres -b -pf /u2/oms/bin/client/rjl/unixclnt.pf -p ommsgmon/msgmon.r
 3.74 progress  7776 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2sm -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO88
 3.62 progress  5009 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
 3.59 progress 26837 /usr/dlc/bin/_proapsv -logginglevel 3 -logfile /u2/dba_logs/appserver/asrjl.server.log -ubpid 26097 -Ms 1 -logname asrjl -logen
 3.45 progress 12908 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
 3.42 progress 26097 /opt/java/jre/bin/IA64W/java -Xverbosegc1:file=/u2/dba_logs/appserver/gc/asrjl.gc.log -Xms32m -Xmx128m -Xss512k -classpath /u0/
 3.32 progress  7746 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859
 3.27 progress  8741 /usr/dlc/bin/_mprosrv /u0/data/rjl/exc2 -m1 -N TCP -Nd /dev/tcp -hs 0 -Mm 1024 -yy 1960 -cpinternal ISO8859-1 -cpstream ISO8859

Thank you very much but there seems to be an undesirable output line:

Code:
f /u1/rjl/db.pf -p gnpr/gnmenum -q -mmax 1024

I think this is the very last line from the original command .. any idea as to how to suppress it ??
Thnx again !!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to use awk to sort this problem out

there has several numbers which are:1,2,3,45,6,7,8,9,0,10,34,34,54,122,6756,54,87,99,2,1,45; how to write a shell script orts the above numbers into descending order and puts them into and arrray and also find and prints the minimum and maximum of those numbers, and finds and prints the average... (4 Replies)
Discussion started by: sonicstage
4 Replies

2. Shell Programming and Scripting

Simple AWK script problem.

Hi all, I have set up a simple awk script to calculate the average of values that are printed out a number of times per second (the number of time the printing occurs varies). The data is of the format shown below: 1 4.43 1 3.65 1 2.45 2 7.65 2 8.23 2 5.65 3 4.65 3 6.21 .. .. 120... (4 Replies)
Discussion started by: omnomtac
4 Replies

3. Shell Programming and Scripting

awk gsub simple problem

Hi New to shell script and awk and need assistance on this problem. I need to use a variable to substitute a string in an external file and write the changed info to another file. At first I did not know if you could use a variable as the sub value but the following showed me that I can. ... (3 Replies)
Discussion started by: hukcjv
3 Replies

4. Programming

sort problem

I am in need of some direction. First off I want to admit this is an assignment but I have hit a block. I need to sort, by the number of times a string occurs (count), and output the top 10. I have found what number gives me the top 10 so from there I need to know how to sort them. Any... (1 Reply)
Discussion started by: Cn00b
1 Replies

5. Shell Programming and Scripting

Simple sort with header

Hi, Please help with this problem. Somehow does not work for me. test.txt CHR SNP BP A1 C_A C_U A2 CHISQ P OR 19 rs10401969 19268718 C 222 890 T 0.03462 0.8524 0.9857 1 rs10873889 ... (4 Replies)
Discussion started by: genehunter
4 Replies

6. Shell Programming and Scripting

simple awk problem

pcn linus> ntpq -p remote refid st t when poll reach delay offset disp ============================================================================== +smpnn01 ntpsrv1 2 u 829 1024 377 1.46 0.793 0.85 *smpnn02 ntpsrv1 2 u ... (2 Replies)
Discussion started by: arch12
2 Replies

7. Shell Programming and Scripting

simple awk problem

Hello; I have the following log file: 10/11/11 10:42:02 LOCK Q Userid:284 Username=root UserPID:23158 Device:marlin batch 10/11/11 10:42:02 TableNr:226 TableName:iatkn RecId:116290398 Flags:X Q H 10/11/11 10:42:02 LOCK CONTENTION X 10/11/11 10:42:02 ... (3 Replies)
Discussion started by: delphys
3 Replies

8. Shell Programming and Scripting

Simple awk problem II

Hello; Trying to figure out how to keep just the contents between the two search lines: awk '/regexp_1/ ,/regexp_2/' I do not want lines containing regexp_1 and regexp_2 in the output. Thank you for any ideas Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Discussion started by: delphys
5 Replies

9. Shell Programming and Scripting

another simple awk problem

Hello; I need to print two previous lines after searching for a reg exp: awk '/haywood/' should produce the following =================== p9J46THe020804 89922 Tue Oct 18 21:06 MAILER-DAEMON (host map: lookup (haywood.com): deferred) ... (1 Reply)
Discussion started by: delphys
1 Replies

10. Shell Programming and Scripting

Simple awk search problem

Hello; we have : awk '/reg_exp/,0/ prints every line after the first occurrence of "reg_exp" But if I want to print rest of the lines AFTER the last occurrence of "reg_exp", how would I do it ?? Tried : awk ' ! (/reg_exp/,0)' But it errored... Thank you for any... (5 Replies)
Discussion started by: delphys
5 Replies
dtruss(1m)							   USER COMMANDS							dtruss(1m)

NAME
dtruss - process syscall details. Uses DTrace. SYNOPSIS
dtruss [-acdeflhoLs] [-t syscall] { -p PID | -n name | command } DESCRIPTION
dtruss prints details on process system calls. It is like a DTrace version of truss, and has been designed to be less intrusive than truss. Of particular interest is the elapsed times and on cpu times, which can identify both system 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 system call counts -d print relative timestamps, us -e print elapsed times, us -f follow children as they are forked -l force printing of pid/lwpid per line -L don't print pid/lwpid per line -n name examine processes with this name -o print on-cpu times, us -s print stack backtraces -p PID examine this PID -t syscall examine this syscall only EXAMPLES
run and examine the "df -h" command # dtruss df -h examine PID 1871 # dtruss -p 1871 examine all processes called "tar" # dtruss -n tar run test.sh and follow children # dtruss -f test.sh run the "date" command and print elapsed and on cpu times, # dtruss -eo date 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 SYSCALL(args) system call name, with arguments (some may be evaluated) 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
dtruss will run forever until Ctrl-C is hit, or if a command was executed dtruss will finish when the command ends. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
procsystime(1M), dtrace(1M), truss(1) version 0.80 Jun 17, 2005 dtruss(1m)
All times are GMT -4. The time now is 04:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy