The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shared memory giving wrong value ajaysahoo AIX 1 12-29-2008 06:42 AM
Giving input to a c++ file tonyaim83 Shell Programming and Scripting 2 10-23-2007 01:10 AM
Script giving wrong results.... mgirinath Shell Programming and Scripting 1 12-21-2005 09:45 PM
Giving input through script radhika03 Shell Programming and Scripting 1 08-17-2005 12:40 AM
Backup is giving me input/output error JPigford UNIX for Dummies Questions & Answers 8 01-28-2005 07:00 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-01-2009
usha rao usha rao is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 70
Question AWK command giving wrong input

Hi all,

I have a problem with qwk command.

i have to check process status and for that i am using command
prstat -mvL 1 1
and it gives me the entire output
but when i use this command with awk like this:
prstat -mvL 1 1 | awk -F" " '{print $1,$15}'
to get first and 15th arguments.

but when i give this command i dont get the entire output which i get when i give just prstat -mvL 1 1
Any ideas why this is happening??

Thanks in advance
U
  #2 (permalink)  
Old 04-01-2009
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,307
Post the output of your prstat command and the desired output within code tags (select the text with your mouse and press the # above the edit box).

Regards
  #3 (permalink)  
Old 04-01-2009
usha rao usha rao is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 70
Hi Franklin,
When i use just this command:

prstat -mvL 1 1
i get
Code:
 
"PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
  8606 oasis     18 4.1 0.0 0.0 0.0 0.0  78 0.0  26 186  9K   0 java/140
  8606 oasis     17 4.5 0.0 0.0 0.0 0.0  79 0.0  42 125  9K   0 java/142
  1275 oasis    2.1  19 0.0 0.0 0.0 0.0  80 0.0  62  71  2K   0 prstat/1
  8606 oasis     17 4.2 0.0 0.0 0.0 0.0  79 0.0  30 209  6K   0 java/143
  8606 oasis    9.9 0.0 0.0 0.0 0.0 0.0  90 0.0   6  66  33   0 java/133
  8606 oasis    4.9 0.7 0.0 0.0 0.0 0.0  94 0.0   9  50  2K   0 java/134
  3086 oasis    5.0 0.1 0.0 0.0 0.0 0.0  59 0.0  23  22  56   0 java/4
  3085 oasis    3.2 0.1 0.0 0.0 0.0 0.0  60 0.0  20  15  49   0 java/4
 24127 oasis    2.5 0.2 0.0 0.0 0.0 1.0  65 0.0  22  26 124   0 java/8
 24127 oasis    2.5 0.2 0.0 0.0 0.0 1.2  65 0.0  22  27 125   0 java/6
 24127 oasis    2.5 0.2 0.0 0.0 0.0 1.5  65 0.0  22  26 124   0 java/12
 24127 oasis    2.4 0.2 0.0 0.0 0.0 1.3  65 0.0  22  26 122   0 java/9
 24127 oasis    2.4 0.2 0.0 0.0 0.0 1.2  65 0.0  22  26 124   0 java/15
 24127 oasis    2.4 0.2 0.0 0.0 0.0 1.2  65 0.0  22  26 123   0 java/5
 24127 oasis    2.3 0.2 0.0 0.0 0.0 1.1  65 0.0  20  25 115   0 java/16
 24127 oasis    2.2 0.2 0.0 0.0 0.0 1.2  65 0.0  21  24 115   0 java/7
  3085 oasis    2.4 0.0 0.0 0.0 0.0 0.0  98 0.0   2   9  11   0 java/486
 24127 oasis    2.2 0.2 0.0 0.0 0.0 1.1  66 0.0  20  23 110   0 java/10
 24127 oasis    1.9 0.2 0.0 0.0 0.0 0.0  66 0.0  18  20  98   0 java/14
 24127 oasis    1.6 0.1 0.0 0.0 0.0 0.0  66 0.0  15  17  83   0 java/11
  8606 oasis    1.6 0.0 0.0 0.0 0.0 0.0  98 0.0   4   6  36   0 java/135
  3357 oasis    1.5 0.1 0.0 0.0 0.0 0.0  50 0.0   0   7  37   0 java/51
 24127 oasis    1.4 0.1 0.0 0.0 0.0 1.3  66 0.0  13  15  70   0 java/13
  3085 oasis    1.3 0.0 0.0 0.0 0.0 0.0  99 0.0   1   4   7   0 java/479
  3086 oasis    1.2 0.0 0.0 0.0 0.0 0.0  99 0.0   1   9   5   0 java/366
  8606 oasis    1.2 0.0 0.0 0.0 0.0 0.0  99 0.0   6   2  45   0 java/132
 19318 oasis    0.9 0.2 0.0 0.0 0.0 0.0  53 0.0   3   3  40   0 java/42
  3085 oasis    1.0 0.0 0.0 0.0 0.0 0.0  57 0.0   1   4  11   0 java/459
 14224 oasis    0.7 0.3 0.0 0.0 0.0 0.0  63 0.0   5   1  75   0 java/562
  3085 oasis    1.0 0.0 0.0 0.0 0.0 0.0  68 0.0   7   4  17   0 java/450
  3354 oasis    0.9 0.1 0.0 0.0 0.0 0.0  61 0.0   0   2  24   0 java/9
  8606 oasis    0.8 0.1 0.0 0.0 0.0 0.0  72 0.0  10   2  19   0 java/14
  3086 oasis    0.9 0.0 0.0 0.0 0.0 0.0  57 0.0   4   3   6   0 java/350
  3085 oasis    0.8 0.0 0.0 0.0 0.0 0.0  52 0.0   6   4   6   0 java/328
 19318 oasis    0.8 0.0 0.0 0.0 0.0 0.0  54 0.0   6   2  12   0 java/4
  3085 oasis    0.7 0.0 0.0 0.0 0.0 0.0  63 0.0   9   8   7   0 java/474
  3086 oasis    0.7 0.0 0.0 0.0 0.0 0.0  62 0.0   4   6   5   0 java/353
  8606 oasis    0.7 0.0 0.0 0.0 0.0 0.0  99 0.0   5   0  31   0 java/141
  6435 oasis    0.7 0.0 0.0 0.0 0.0 0.0  99 0.0   2   3  14   0 java/131
 19318 oasis    0.5 0.1 0.0 0.0 0.0 2.1  52 0.0   5   2  29   0 java/10
  5491 mqm      0.3 0.3  -   -   -   -  100  -    6   0  42   0 amqzlaa0_nd/48
 29231 pkodav   0.0 0.6  -   -   -   -   52  -    8   0  34   3 File/1
  3156 rravee   0.0 0.6  -   -   -   -   52  -    8   0  34   3 Track/1
 21075 mvelur   0.0 0.6  -   -   -   -   52  -    8   0  34   3 Track/1
  3085 oasis    0.6 0.0 0.0 0.0 0.0 0.0  74 0.0   6   2   6   0 java/440
   524 root     0.0 0.5  -   -   -   -   69  -    0   0   4   0 automountd/1036
  3085 oasis    0.5 0.0 0.0 0.0 0.0 0.0  74 0.0   6   2   4   0 java/442
 20448 mqm      0.2 0.3  -   -   -   -   54  -   40   6 236   0 amqrmppa/11
  8606 oasis    0.5 0.0 0.0 0.0 0.0 0.0  99 0.0   3   1  33   0 java/137
Total: 524 processes, 5724 lwps, load averages: 2.11, 1.59, 2.45 "
but when i use
prstat -mvL 1 1 | awk -F" " '{print $1,$15}'

i just get
"
Code:
PID PROCESS/LWPID
1331 prstat/1
3086 java/4
3085 java/4
1327 vi/1
24127 java/8
24127 java/6
1332 awk/1
24127 java/12
24127 java/9
24127 java/15
24127 java/5
24127 java/16
24127 java/7
24127 java/10
3085 java/486"

Why is there a difference showing the number of PID's when i use simply and when i use awk.I am just printing 1st and 15th args??

Thanks
  #4 (permalink)  
Old 04-01-2009
Tytalus's Avatar
Tytalus Tytalus is offline Forum Advisor  
echo {1..9}^2\;|bc
  
 

Join Date: Jun 2003
Location: Scotland
Posts: 431
from prstat manpage:

Code:
 By  default,
                          prstat displays as many lines of output
                          that  fit in a window or terminal. When
                          you specify the -c option or direct the
                          output  to  a  file, the default values
                          for ntop and nbottom are 15 and 5.
so....you need to use something like:

Code:
#   prstat -n 60 -mvL 1 1 |  awk -F" " '{print $1,$15}'
HTH
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0