Vmstat | nawk | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Vmstat | nawk

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-20-2013
orange47 orange47 is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 15 October 2014, 11:41 PM EDT
Location: Yugoslavia
Posts: 268
Thanks: 68
Thanked 10 Times in 10 Posts
Vmstat | nawk

I'm trying to parse vmstat output with this:


Code:
vmstat | nawk '/0/{printf "%s\ \n", $5}'

but output is different on two sparc Solaris 10 servers, one is missing line with 'free'.
why ?
Sponsored Links
    #2  
Old 06-20-2013
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 22 October 2014, 10:04 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,234
Thanks: 121
Thanked 453 Times in 412 Posts
Maybe different OS version or vmstat version.
Sponsored Links
    #3  
Old 06-20-2013
orange47 orange47 is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 15 October 2014, 11:41 PM EDT
Location: Yugoslavia
Posts: 268
Thanks: 68
Thanked 10 Times in 10 Posts
wow, fast reply, thanks.
both are running Solaris 10, and vmstat alone output is identical, so it must be nawk or printf?

edit: ahh, my mistake, one server has 0 in line with free. sorry

is there a way to add newline only after last line? (so there is no newline after 'free')

Last edited by orange47; 06-20-2013 at 02:43 AM..
    #4  
Old 06-20-2013
Don Cragun's Avatar
Don Cragun Don Cragun is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 22 October 2014, 9:06 PM EDT
Location: San Jose, CA, USA
Posts: 4,884
Thanks: 182
Thanked 1,641 Times in 1,392 Posts
Try:

Code:
vmstat | nawk '/0/{printf "%s\ ", $5}
END{print ""}'

The Following User Says Thank You to Don Cragun For This Useful Post:
orange47 (06-20-2013)
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
Nesting - two nawk into one nawk gc_sw Shell Programming and Scripting 2 10-21-2010 08:03 AM
vmstat kapilk Shell Programming and Scripting 3 07-28-2009 07:53 AM
vmstat help jcpetela Linux 1 01-21-2009 04:18 PM
how to access values of awk/nawk variables outside the awk/nawk block? saniya Shell Programming and Scripting 5 05-13-2008 07:37 AM
vmstat big123456 UNIX for Advanced & Expert Users 4 12-21-2005 05:56 AM



All times are GMT -4. The time now is 09:38 PM.